Mail Archives: djgpp/1996/09/23/23:48:35
Richard L.F. van Paasen (R DOT L DOT F DOT v DOT Paasen AT stud DOT tue DOT nl) wrote:
: Hi, (subject: write a generic makefile)
: But man, this seems not straightforward for a non-unix programmer. Is
: here
: someone who has written such a (generic) makefile, and who wants to
: share it
: with me (and all newbies that read this newsgroup) ? I'd be glad to
: hear.
Here is the makefile for a project I was working on a while ago, you
can use it as a template.
Rich.
---CUT-HERE---8<--------
# Note! Dependencies are done automagically by 'make depend', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
CC = gcc
LDLIBS =
LDFLAGS =
DEBUG = -g -Wall
OPTIMIZE =
CFLAGS = $(DEBUG) $(OPTIMIZE)
# These rules will compile all your c files to object files
.c.s:
$(CC) $(CFLAGS) -S $<
.c.o:
$(CC) $(CFLAGS) -c $<
# Add your object filenames here
OBJS= your-objects-go-here.o
# This is a special rule to link the project
build: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o output-filename $(OBJS) $(LDLIBS)
depend:
$(CPP) $(CFLAGS) -MM *.c > _depend
#
# include the dependency file if there is one
#
ifeq (.depend,$(wildcard _depend))
include _depend
endif
---CUT-HERE---8<--------
--
________________________________________________________________
| Richard Moore | Email: moorer AT cs DOT man DOT ac DOT uk |
| 17 Langdale Ave, | Phone: (0161) 225 4319 (home) |
| Levenshulme, | (0161) 275 6270 (work) |
| Manchester, M19 3NT | (0161) 275 6280 (fax) |
|________________________________|_______________________________|
- Raw text -