File: makefile.all

package info (click to toggle)
kraptor 0.0.20040403-6
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 12,876 kB
  • ctags: 781
  • sloc: ansic: 7,107; makefile: 109; sh: 63
file content (46 lines) | stat: -rw-r--r-- 1,407 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Makefile generic - Rules to build
# Fixed at last! :), thanks to Schwarzung

TEMP = $(wildcard $(SRCDIR)/*$(SRCSUF))
FILES = $(if $(TEMP), $(TEMP), $(error No source code found!))
OBJS = $(addprefix $(OBJDIR)/,$(addsuffix $(OBJSUF), $(basename $(notdir $(FILES) ) ) ) )

# main target, all project
.PHONY: all
all: $(BINDIR)/$(BINARY)$(BINSUF)

$(BINDIR)/$(BINARY)$(BINSUF) : $(OBJS) 
	$(GCC) $^ -o $@ $(LFLAGS)
	@echo The $(BINDIR)/$(BINARY)$(BINSUF) is ready!

$(OBJDIR)/%$(OBJSUF) : $(SRCDIR)/%$(SRCSUF)
	$(GCC) $(CFLAGS) -c $< -o $@

.PHONY: clean and also clean the test
clean: cleantest
	rm -rf $(BINDIR)/$(BINARY)$(BINSUF) $(OBJS)

# Strip symbols and compress with upx packer (http://upx.sf.net/)
.PHONY: upx
upx:
	strip --strip-all $(BINDIR)/$(BINARY)$(BINSUF)
	upx --best $(BINDIR)/$(BINARY)$(BINSUF)

# Install - Please add here your custom installation functions
.PHONY: install
install:
	@echo Sorry, the install feature is not done yet.

# Test if the system can compile - PLEASE MODIFY THIS TO SUIT YOUR NEEDS!
# Compile the program
# The test.run is to check if make run or not in DJGPP enviroment (ugly hack)
# seems that DOS don't set errorlevel if fails to execute a program
.PHONY: test
test:
	$(GCC) $(TESTFILE)$(SRCSUF) -o $(TESTFILE)$(BINSUF) $(CFLAGS) $(LFLAGS)
	echo "don't edit me" > test.run

# Cleans the test
.PHONY: cleantest
cleantest: 
	rm -rf $(TESTFILE)$(BINSUF) test.run