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
72
73
74
75
76
77
|
# Edam's Makefile v1.8
#___________________________________________________________________________
# S E T T I N G S
# Target binary
TARGET := tim
# All source files
CC_SRCS :=
C_SRCS :=
S_SRCS :=
# Libraries
LIBRARIES :=
# Override options (better: specify in environment or on cmdline)
#DEBUGMODE := 1
CPPBUILD := 1
#STATICLIBS := 1
BUILDLIB := 1
# Initial flags
CPPFLAGS :=
ASFLAGS :=
LDFLAGS :=
#___________________________________________________________________________
# Software
AS := nasm
CC := $(if $(CPPBUILD), g++, gcc)
ifdef DEBUGMODE
# Debug build flags
CPPFLAGS := -g -D DEBUG $(CPPFLAGS)
ASFLAGS := -f elf -g -dDEBUG $(ASFLAGS)
LDFLAGS := -Wall $(if $(STATICLIBS), -static) $(LDFLAGS)
else
# Release build flags
CPPFLAGS := -O2 $(CPPFLAGS)
ASFLAGS := -f elf -O2 $(ASFLAGS)
LDFLAGS := -Wall -s $(if $(STATICLIBS), -static) $(LDFLAGS)
endif
# More variables...
DEPFILE := Depends
_SRCS := $(CC_SRCS) $(C_SRCS) $(S_SRCS)
_OBJS := $(addsuffix .o,$(basename $(_SRCS)))
LDLIBS := $(addprefix -l,$(LIBRARIES))
.PHONY: all clean run depend dep
all: depend $(TARGET)
$(TARGET): $(_OBJS)
ifdef BUILDLIB
$(AR) rcs $(TARGET) $(_OBJS)
else
$(CC) -o $(TARGET) $(LDFLAGS) $(LDLIBS) $(_OBJS)
endif
clean:
rm -f core $(DEPFILE) $(_OBJS)
rm -f *~
run: $(TARGET)
./$(TARGET)
depend dep:
# makedepend -f- -- $(CPPFLAGS) -- $(_SRCS) > $(DEPFILE)
#___________________________________________________________________________
#include $(DEPFILE)
|