2 # Thanks to Schwarzung for help.
3 # Copyright (c) 2003-2005, Kronoman
5 TEMP = $(wildcard $(SRCDIR)/*$(SRCSUF))
6 FILES = $(if $(TEMP), $(TEMP), $(error No source code found!))
7 OBJS = $(addprefix $(OBJDIR)/,$(addsuffix $(OBJSUF), $(basename $(notdir $(FILES) ) ) ) )
9 # main target, all project
11 all: $(BINDIR)/$(BINARY)$(BINSUF)
13 $(BINDIR)/$(BINARY)$(BINSUF) : $(OBJS)
14 $(GCC) $^ -o $@ $(LFLAGS)
15 @echo The $(BINDIR)/$(BINARY)$(BINSUF) is ready!
17 $(OBJDIR)/%$(OBJSUF) : $(SRCDIR)/%$(SRCSUF)
18 $(GCC) $(CFLAGS) -c $< -o $@
20 .PHONY: clean and also clean the test
22 rm -rf $(BINDIR)/$(BINARY)$(BINSUF) $(OBJS)
24 # Strip symbols and compress with upx packer (http://upx.sf.net/)
27 strip --strip-all $(BINDIR)/$(BINARY)$(BINSUF)
28 upx --best $(BINDIR)/$(BINARY)$(BINSUF)
30 # Install - Please add here your custom installation functions
33 @echo Sorry, the install feature is not done yet.
35 # Test if the system can compile
37 # The test.run is to check if make run or not in DJGPP enviroment (ugly hack)
38 # seems that DOS don't set errorlevel if fails to execute a program
41 $(GCC) $(TESTFILE)$(SRCSUF) -o $(TESTFILE)$(BINSUF) $(CFLAGS) $(LFLAGS)
42 @echo "don't edit me" > test.run
47 rm -rf $(TESTFILE)$(BINSUF) test.run