automake - Makefile.am - ELF output

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
engine252
Posts: 6
Joined: Mon May 19, 2008 11:27 am
Location: Belgium

automake - Makefile.am - ELF output

Post by engine252 »

How can i make a Makefile.am that outputs a ELF or flat binary file.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

As far as I know, automake can only create makefiles. Use GCC instead.

Also, do you actually know how your tools work? That's a prerequisite for developing an OS for good reason.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

This is an interesting test case for the RTFM and STFW thread a little while back.
Lets sit back and watch!

-JL

[ON TOPIC] To make an ELF (under Linux, idk about other places):
gcc test.c -o test
or, under 64bit to make a 32 bit version: Add -m32 flag.

IIRC, to make a flat binary, you need to use ld or another linker), am I right?

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: automake - Makefile.am - ELF output

Post by JamesM »

engine252 wrote:How can i make a Makefile.am that outputs a ELF or flat binary file.
Read the manual.
engine252
Posts: 6
Joined: Mon May 19, 2008 11:27 am
Location: Belgium

Post by engine252 »

i have read the manual and now i added the line

format=elf

but now i only get a kernel.o file

if i rename this file to kernel.bin and load it with grub i get
unsupported file format

i guess i have to link it but don't know how to tell it to automake

i'd like to use automake for my little OS development project so if someone can get me started.

thx in advance.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

You have to tell automake to create an executable.

Read the autoconf manual too - they go hand in hand.

I really can't recommend autoconf/automake to anyone, I've found them to be nothing but trouble. Personally, I would recommend CMake.
User avatar
Steve the Pirate
Member
Member
Posts: 152
Joined: Fri Dec 15, 2006 7:01 am
Location: Brisbane, Australia
Contact:

Post by Steve the Pirate »

Yeah, I tried automake too, and couldn't get it to make the binary without getting all these unresolved symbols, no matter how many linker flags I tried to give it... I still haven't found a better replacement for my makefile...
My Site | My Blog
Symmetry - My operating system.
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Post by Zenith »

OP: Since I'm assuming you're using gcc, remove the -c flag so that the kernel actually gets linked. Read the manual (for GCC, since I really doubt this is an automake issue).

I tried autoconf/automake once, ditched automake (since I'd made a much more flexible, non-recursive Makefile.in) and (partly) stuck with autoconf. Though ./configure is pretty bloated, it's preferable for compiler detection and since I compile my OS to 3 different architectures, it allows me to work on, compile, and test any of the 3 versions at the same time.
"Sufficiently advanced stupidity is indistinguishable from malice."
Post Reply