2000-12-10 04:09:52 +00:00
|
|
|
#
|
|
|
|
# GNU makefile fragment for building an executable
|
|
|
|
#
|
|
|
|
|
2001-05-03 02:24:39 +00:00
|
|
|
CC = gcc
|
|
|
|
NASM = nasm
|
2000-12-10 04:09:52 +00:00
|
|
|
# LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static
|
2001-05-03 02:24:39 +00:00
|
|
|
LINKAGE = -static
|
|
|
|
LINK = gcc $(LINKAGE)
|
|
|
|
BINPATH = ../../obj/bin
|
|
|
|
LIBPATH = ../../obj/lib
|
|
|
|
PROGRAM = $(BINPATH)/$(PROGRAM_NAME)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
|
|
|
all : release
|
|
|
|
|
2001-05-03 00:48:32 +00:00
|
|
|
debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES)
|
|
|
|
release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -ffast-math -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
|
|
|
LFLAGS = -L$(LIBPATH)
|
|
|
|
|
|
|
|
debug : $(PROGRAM)
|
|
|
|
release : $(PROGRAM)
|
|
|
|
|
|
|
|
$(PROGRAM) : $(OBJS)
|
|
|
|
$(LINK) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
|
|
|
|
|
|
|
|
%.o : %.c
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
%.i : %.c
|
|
|
|
$(CC) $(CFLAGS) -E $< -o $@
|
|
|
|
|
2001-05-25 00:21:42 +00:00
|
|
|
%.o : %.s
|
2001-05-03 02:24:39 +00:00
|
|
|
$(NASM) -f elf -d ELF -i i386/ $< -o $@
|
|
|
|
|
2000-12-10 04:09:52 +00:00
|
|
|
.PHONY : clean
|
|
|
|
clean :
|
|
|
|
-rm -f $(OBJS) $(PROGRAM)
|
|
|
|
|
|
|
|
.PHONY : depend
|
|
|
|
depend:
|
|
|
|
makedepend -- $(CFLAGS) $(INCLUDES) -- *.c
|