new makefile with mingw support built in

git-svn-id: svn://svn.icculus.org/twilight/trunk/dpmodel@5728 d7cf8633-e32d-0410-b094-e92efae38249
This commit is contained in:
havoc 2005-09-28 09:12:27 +00:00
parent 447b4938de
commit 6b4a42106c
2 changed files with 35 additions and 60 deletions

View file

@ -1,34 +1,45 @@
OBJECTS= dpmodel.o
##### Win32 variables #####
#use this line for profiling
#PROFILEOPTION=-pg -g
#use this line for no profiling
PROFILEOPTION=
WIN32_EXE=dpmodel.exe
WIN32_LDFLAGS=-lm
#note:
#the -Werror can be removed to compile even if there are warnings,
#this is used to ensure that all released versions are free of warnings.
##### Unix variables #####
#normal compile
OPTIMIZATIONS= -O6 -ffast-math -fexpensive-optimizations
CFLAGS= -MD -Wall -Werror $(OPTIMIZATIONS) $(PROFILEOPTION)
#debug compile
#OPTIMIZATIONS= -O -g
#CFLAGS= -MD -Wall -Werror -ggdb $(OPTIMIZATIONS) $(PROFILEOPTION)
UNIX_EXE=dpmodel
UNIX_LDFLAGS=-lm
LDFLAGS= -lm $(PROFILEOPTION)
##### Common variables #####
all: dpmodel
CC=gcc
CFLAGS=-MD -Wall -O2
ifdef windir
CMD_RM=del
else
CMD_RM=rm -f
endif
##### Commands #####
.PHONY: all mingw clean
all:
ifdef windir
$(MAKE) EXE=$(WIN32_EXE) LDFLAGS="$(WIN32_LDFLAGS)" $(WIN32_EXE)
else
$(MAKE) EXE=$(UNIX_EXE) LDFLAGS="$(UNIX_LDFLAGS)" $(UNIX_EXE)
endif
mingw:
@$(MAKE) EXE=$(WIN32_EXE) LDFLAGS="$(WIN32_LDFLAGS)" $(WIN32_EXE)
.c.o:
gcc $(CFLAGS) -c $*.c
$(CC) $(CFLAGS) -c $*.c
dpmodel: $(OBJECTS)
gcc -o $@ $^ $(LDFLAGS)
$(EXE): dpmodel.o
$(CC) -o $@ $^ $(LDFLAGS)
clean:
-rm -f dpmodel *.o *.d
.PHONY: clean
-include *.d
-$(CMD_RM) $(WIN32_EXE)
-$(CMD_RM) $(UNIX_EXE)
-$(CMD_RM) *.o

View file

@ -1,36 +0,0 @@
OBJECTS= dpmodel.o
#use this line for profiling
#PROFILEOPTION=-pg -g
#use this line for no profiling
PROFILEOPTION=
#note:
#the -Werror can be removed to compile even if there are warnings,
#this is used to ensure that all released versions are free of warnings.
#normal compile
OPTIMIZATIONS= -O6 -ffast-math -fexpensive-optimizations
CFLAGS= -MD -Wall -Werror $(OPTIMIZATIONS) $(PROFILEOPTION)
#debug compile
#OPTIMIZATIONS= -O -g
#CFLAGS= -MD -Wall -Werror -ggdb $(OPTIMIZATIONS) $(PROFILEOPTION)
LDFLAGS= -lm $(PROFILEOPTION)
all: dpmodel.exe
.c.o:
gcc $(CFLAGS) -c $*.c
dpmodel.exe: $(OBJECTS)
gcc -o $@ $^ $(LDFLAGS)
clean:
-del dpmodel.exe
-del *.o
-del *.d
.PHONY: clean
-include *.d