1 # Makefile generic - Rules to build
2 # Fixed at last! :), thanks to Schwarzung
4 TEMP = $(wildcard $(SRCDIR)/*$(SRCSUF))
5 FILES = $(if $(TEMP), $(TEMP), $(error No source code found!))
6 OBJS = $(addprefix $(OBJDIR)/,$(addsuffix $(OBJSUF), $(basename $(notdir $(FILES) ) ) ) )
8 # main target, all project
10 all: $(BINDIR)/$(BINARY)$(BINSUF)
12 $(BINDIR)/$(BINARY)$(BINSUF) : $(OBJS)
13 $(GCC) $^ -o $@ $(LFLAGS)
14 @echo The $(BINDIR)/$(BINARY)$(BINSUF) is ready!
16 $(OBJDIR)/%$(OBJSUF) : $(SRCDIR)/%$(SRCSUF)
17 $(GCC) $(CFLAGS) -c $< -o $@
19 .PHONY: clean and also clean the test
21 rm -rf $(BINDIR)/$(BINARY)$(BINSUF) $(OBJS)
23 # Strip symbols and compress with upx packer (http://upx.sf.net/)
26 strip --strip-all $(BINDIR)/$(BINARY)$(BINSUF)
27 upx --best $(BINDIR)/$(BINARY)$(BINSUF)
29 # Install - Please add here your custom installation functions
32 @echo Sorry, the install feature is not done yet.
34 # Test if the system can compile - PLEASE MODIFY THIS TO SUIT YOUR NEEDS!
36 # The test.run is to check if make run or not in DJGPP enviroment (ugly hack)
37 # seems that DOS don't set errorlevel if fails to execute a program
40 $(GCC) $(TESTFILE)$(SRCSUF) -o $(TESTFILE)$(BINSUF) $(CFLAGS) $(LFLAGS)
41 echo "don't edit me" > test.run
46 rm -rf $(TESTFILE)$(BINSUF) test.run