/make/edam-mk

To get this branch, use:
bzr branch http://bzr.ed.am/make/edam-mk
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#                                                       Edam's Makefile v1.6
#___________________________________________________________________________
#                                                            S E T T I N G S

# Target binary
TARGET		= groups

# All source files
CC_SRCS		=
C_SRCS		= groups.c xmalloc.c
S_SRCS		= 

# Libraries
LIBRARIES	= 

# Options (comment-out to disable)
DEBUG		= 1
#CPPBUILD	= 1
#STATICLIBS	= 1

#___________________________________________________________________________
#                                                                    M E A T

# Software
AS=nasm

ifdef DEBUG

# Debug build flags
CPPFLAGS	= -g -D DEBUG
ASFLAGS		= -f elf -g -dDEBUG
LDFLAGS		= -Wall $(if $(STATICLIBS), -static)

else

# Release build flags
CPPFLAGS	= -O2
ASFLAGS		= -f elf -O2
LDFLAGS		= -Wall -s $(if $(STATICLIBS), -static)

endif

# More variables...
DEPFILE		= Depends
_SRCS		= $(CC_SRCS) $(C_SRCS) $(S_SRCS)
_OBJS		= $(addsuffix .o,$(basename $(_SRCS)))
LDLIBS		= $(addprefix -l,$(LIBRARIES))

# Main rule...
$(TARGET): $(_OBJS)
	$(if $(CPPBUILD), g++, gcc) -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)

#___________________________________________________________________________
#                                                                  R U L E S

.PHONY:	all clean run depend dep

all:	clean depend $(TARGET)

clean:
	rm -f core $(DEPFILE) $(_OBJS)
	rm -f *~

run:	$(TARGET)
	./$(TARGET)

depend dep:
#	makedepend -f- -- $(CPPFLAGS) -- $(_SRCS) > $(DEPFILE)

#___________________________________________________________________________
#include $(DEPFILE)