Mail Archives: djgpp/1996/08/01/12:55:57
Date: Wed, 31 Jul 1996 13:19:52 +0200
From: ion2 AT freenet DOT hut DOT fi (Andreas Vernersson)
I'd like little to know about makefiles.. um.. could someone show
an makefile-version of my compile bat file?
gcc -Wall -m486 -O3 vesa.c -o vesa.o
gcc -Wall -m486 -O3 gfx.c -o gfx.o
gcc -Wall -m486 -O3 test.c -o test.o
gcc -s vesa.o gfx.o test.o -o test.exe
OK:
##### BEGIN makefile ####
#Declare name of C compiler, used internally by predefined make rules
CC=gcc
#Declare compiler options used by builtin make rules
CFLAGS=-Wall -m486 $(CDFLAGS)
#Declare debugging/optimization related options I used in declaring CFLAGS above,
#note that make macr definitions are compiled before used so that one can use them
#before declaring them.
CDFLAGS=-O3
#This is the first TARGET in the file so it is the default target to make. It
#declares that it depends on the three .o's triggering checks of their timeliness.
#If any of the .o's is newer than the .exe execute the following command(s).
test.exe: test.o gfx.o vesa.o
$(CC) -o test.exe test.o gfx.o vesa.o
#^^^^^^NOTE THAT THIS MUST BE A TAB CHARACTER NOT SPACES!!!!!!!!!!
# BTW: This is a makefile comment line
#If test.c newer than test.o remake test.o using built-in suffix rules.
test.o: test.c
#Blank lines between rules are optional.
gfx.o: gfx.c
vesa.o: vesa.c
#### END makefile ####
Just name this file 'makefile' and type:
make
or name it 'test.mk'
and type:
make -f test.mk
To make one of the .o's only:
make gfx.o
--
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
A proverb is no proverb to you 'till life has illustrated it. -- John Keats
- Raw text -