/make/edam-mk

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