-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
138 lines (106 loc) · 3.66 KB
/
Makefile
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
TARGET = RomImageFuzzyMatcher
export TARGET_STRING = \"$(TARGET)\"
#---------------------------------------------------------------------------------
# Account for normal c/cpp files
#---------------------------------------------------------------------------------
CFILES := $(wildcard *.c)
CPPFILES := $(wildcard *.cpp)
export OBJS = \
$(CFILES:.c=.o) \
$(CPPFILES:.cpp=.o) \
#---------------------------------------------------------------------------------
## Any other build targets you want to add
#---------------------------------------------------------------------------------
#OBJS += logo.o
CDEPS = $(CFILES:.c=.d)
CPPDEPS = $(CPPFILES:.cpp=.d)
DEPS = $(CDEPS) $(CPPDEPS)
SOURCES = $(CFILES) $(CPPFILES)
INCDIR = ./ /usr/include
ifdef RELEASE
CFLAGS = -O2 -Wall -DTARGET_STRING=$(TARGET_STRING)
else
CFLAGS = -ggdb -g3 -O0 -Wall -DTARGET_STRING=$(TARGET_STRING)
endif
CFLAGS += $(addprefix -I,$(INCDIR))
CXXFLAGS = $(CFLAGS)
# Had to allow rtti for boost library...
#-fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS= -lc -lstdc++ \
# Main target
$(TARGET): $(OBJS)
@echo " The OBJS: $(OBJS)"
$(CXX) -MMD -MP -MF $*.d $(CFLAGS) $(OBJS) $(LIBS) -o $@
#---------------------------------------------------------------------------------
# Release details
#---------------------------------------------------------------------------------
#REL_OPTIMIZE = -O2
#export RELEASE_FOLDER = release_dir/TimeCube/
#
#export RELEASE_FLAGS = -DBUILD_TYPE=RELEASE -DRELEASE $(REL_OPTIMIZE)
rar: ctags
rar a $(TARGET).rar $(RELEASE_FOLDER)
#---------------------------------------------------------------------------------
# Rules for building cpp files (if you have them)
#---------------------------------------------------------------------------------
%.o: %.cpp
@echo $(notdir $<)
$(MAKE) tags
$(CXX) -MMD -MP -MF $*.d $(CXXFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
# Rules for building c files if you have them
#---------------------------------------------------------------------------------
%.o: %.c
@echo $(notdir $<)
$(MAKE) tags
$(CC) -MMD -MP -MF $*.d $(CFLAGS) -c $< -o $@
-include $(DEPS)
.IGNORE: clean
#---------------------------------------------------------------------------------
# Get rid of all the intermediary makefiles (.d files)
#---------------------------------------------------------------------------------
clean:
rm $(OBJS) $(TARGET)
clean-deps:
-rm $(DEPS)
debug:
$(MAKE) "DEBUG=1"
release:
$(MAKE) "RELEASE=1"
#---------------------------------------------------------------------------------
# Clean Deps and all object files
#---------------------------------------------------------------------------------
clean-all: clean-deps clean
diff:
svn diff --diff-cmd=diffwrap
run: $(TARGET)
./$(TARGET)
#---------------------------------------------------------------------------------
# Remake editor tags
#---------------------------------------------------------------------------------
tags: $(SOURCES)
-ctags -R --sort=yes --c++-kinds=+cdefgmnpstux \
--fields=+iaKS --extra=+q ./
ctags: tags
#-----------------------------------------------------------
# Ctags flag info:
#-----------------------------------------------------------
#C++
# c classes
# d macro definitions
# e enumerators (values inside an enumeration)
# f function definitions
# g enumeration names
# l local variables [off]
# m class, struct, and union members
# n namespaces
# p function prototypes [off]
# s structure names
# t typedefs
# u union names
# v variable definitions
# x external and forward variable declarations [off]
#