/make/edam-mk

To get this branch, use:
bzr branch http://bzr.ed.am/make/edam-mk
4 by edam
- replaced debug option with debug switch
1
#                                                       Edam's Makefile v1.5
3 by edam
- added propper header
2
#___________________________________________________________________________
3
#                                                            S E T T I N G S
4
1 by edam
initial makefile
5
# Target binary
4 by edam
- replaced debug option with debug switch
6
TARGET		= helloworld
1 by edam
initial makefile
7
8
# All source files
4 by edam
- replaced debug option with debug switch
9
CC_SRCS		= helloworld.cc
2 by edam
switched compiler to g++
10
C_SRCS		= 
4 by edam
- replaced debug option with debug switch
11
S_SRCS		= 
3 by edam
- added propper header
12
13
# Libraries
14
LIBRARIES	= 
15
4 by edam
- replaced debug option with debug switch
16
# Uncomment for debug-build
17
DEBUG		= 1
3 by edam
- added propper header
18
19
#___________________________________________________________________________
20
#                                                                    M E A T
21
22
# Software
23
AS=nasm
1 by edam
initial makefile
24
4 by edam
- replaced debug option with debug switch
25
ifdef DEBUG
26
27
# Debug build flags
28
CPPFLAGS	= -g -D DEBUG
29
ASFLAGS		= -f elf -g -dDEBUG
30
LDFLAGS		= -Wall
31
32
else
33
34
# Release build flags
35
CPPFLAGS	= -O2
36
ASFLAGS		= -f elf -O2
37
LDFLAGS		= -Wall -s
38
39
endif
40
1 by edam
initial makefile
41
# More variables...
42
DEPFILE		= Depends
3 by edam
- added propper header
43
_SRCS		= $(CC_SRCS) $(C_SRCS) $(S_SRCS)
44
_OBJS		= $(addsuffix .o,$(basename $(_SRCS)))
45
LDLIBS		= $(addprefix -l,$(LIBRARIES))
1 by edam
initial makefile
46
47
# Main rule...
3 by edam
- added propper header
48
$(TARGET): $(_OBJS)
4 by edam
- replaced debug option with debug switch
49
	g++ -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
1 by edam
initial makefile
50
3 by edam
- added propper header
51
#___________________________________________________________________________
52
#                                                                  R U L E S
1 by edam
initial makefile
53
4 by edam
- replaced debug option with debug switch
54
.PHONY:	all clean run depend dep
1 by edam
initial makefile
55
56
all:	clean depend $(TARGET)
57
58
clean:
3 by edam
- added propper header
59
	rm -f core $(DEPFILE) $(_OBJS)
1 by edam
initial makefile
60
	rm -f *~
61
4 by edam
- replaced debug option with debug switch
62
run:	$(TARGET)
63
	./$(TARGET)
64
1 by edam
initial makefile
65
depend dep:
3 by edam
- added propper header
66
#	makedepend -f- -- $(CPPFLAGS) -- $(_SRCS) > $(DEPFILE)
1 by edam
initial makefile
67
3 by edam
- added propper header
68
#___________________________________________________________________________
1 by edam
initial makefile
69
#include $(DEPFILE)