Fixes building problem on all 64 bit arches
[kraptor.git] / makefile.all
blob8bd718035c7f68f7248b7cb5107ea3144a062fa8
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
9 .PHONY: all
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
20 clean: cleantest
21         rm -rf $(BINDIR)/$(BINARY)$(BINSUF) $(OBJS)
23 # Strip symbols and compress with upx packer (http://upx.sf.net/)
24 .PHONY: upx
25 upx:
26         strip --strip-all $(BINDIR)/$(BINARY)$(BINSUF)
27         upx --best $(BINDIR)/$(BINARY)$(BINSUF)
29 # Install - Please add here your custom installation functions
30 .PHONY: install
31 install:
32         @echo Sorry, the install feature is not done yet.
34 # Test if the system can compile - PLEASE MODIFY THIS TO SUIT YOUR NEEDS!
35 # Compile the program
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
38 .PHONY: test
39 test:
40         $(GCC) $(TESTFILE)$(SRCSUF) -o $(TESTFILE)$(BINSUF) $(CFLAGS) $(LFLAGS)
41         echo "don't edit me" > test.run
43 # Cleans the test
44 .PHONY: cleantest
45 cleantest: 
46         rm -rf $(TESTFILE)$(BINSUF) test.run