-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (66 loc) · 1.75 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
SOURCES = $(CXX_OBJECTS:%.o=%.cpp) $(C_OBJECTS:%.o=%.c) \
$(MAIN_OBJECT:%.o=%.cpp)
LIB_OBJECTS = $(CXX_OBJECTS) $(C_OBJECTS)
CXX_OBJECTS = MiniParser.o
MAIN_OBJECT = example.o
ARCH = $(shell uname)
TARGET = example
LIBTARGET = libMiniParser.a
COMPILER = g++
#COMPILER = gfilt
WARNINGFLAGS = -Wall -Wshadow -Woverloaded-virtual -Wno-sign-compare
# WARNINGFLAGS += -Winit-self
# Does this help? -falign-loops=16
COMPILERFLAGS = $(WARNINGFLAGS)
COMPILERFLAGS += -g
#COMPILERFLAGS += -O3
#COMPILERFLAGS += -DNDEBUG
#COMPILERFLAGS += -fno-inline
#COMPILERFLAGS += -finline-functions
COMPILERFLAGS += -fkeep-inline-functions
#COMPILERFLAGS += -Winline
AR = /usr/bin/ar
ARFLAGS = -rus
MAKEDEPEND = g++ -MM
DEPENDFILE = Makefile.depend
INCLUDEFLAGS =
LINKTIMEFLAGS =
include Makefile.$(ARCH)
# clear out implicit rules
.SUFFIXES:
all: $(LIBTARGET) $(TARGET)
$(TARGET): $(MAIN_OBJECT) $(LIBTARGET)
$(COMPILER) -o $@ \
$(MAIN_OBJECT) \
$(LIBTARGET) \
$(FRAMEWORKS) \
$(INCLUDEFLAGS) $(LINKTIMEFLAGS)
# $(INCLUDEFLAGS) $(LINKTIMEFLAGS) $(LIBTARGET) $(LINKTIMEFLAGS) \
#$(TARGET): $(LIB_OBJECTS) $(MAIN_OBJECT)
# $(COMPILER) -o $@ \
# $(LIB_OBJECTS) $(MAIN_OBJECT) \
# $(INCLUDEFLAGS) $(LINKTIMEFLAGS) \
# $(FRAMEWORKS)
library: $(LIBTARGET)
relink: cleantarget all
$(LIBTARGET): $(LIB_OBJECTS)
$(AR) $(ARFLAGS) $@ $(LIB_OBJECTS)
%.o: %.cpp
$(COMPILER) $(COMPILERFLAGS) $(INCLUDEFLAGS) -c $<
%.o: %.c
$(COMPILER) $(COMPILERFLAGS) $(INCLUDEFLAGS) -c $<
.PHONY : clean tidy
clean: tidy
rm -f $(TARGET)
rm -f $(LIBTARGET)
rm -f $(DEPENDFILE)
touch $(DEPENDFILE)
tidy:
rm -f $(LIB_OBJECTS) $(MAIN_OBJECT)
cleantarget:
rm -f $(TARGET)
depend:
$(MAKEDEPEND) $(INCLUDEFLAGS) $(SOURCES) > $(DEPENDFILE)
include $(DEPENDFILE)
$(DEPENDFILE):
touch $(DEPENDFILE)