-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (72 loc) · 2.36 KB
/
Makefile
File metadata and controls
89 lines (72 loc) · 2.36 KB
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
#
# Copyright 2008, 2009 Keith Reynolds.
#
# This program is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General
# Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# CXX := icc
SOURCES = $(wildcard *.cpp)
TARGETS = $(SOURCES:%.cpp=%)
CPPFLAGS = -I.
CXXFLAGS = $(CPPFLAGS) -g -Wall -Werror
CXXFLAGS_icc = -wd304 -wd981 -wd411
CXXFLAGS_gcc = -Wextra
CXXFLAGS_g++ = $(CXXFLAGS_gcc)
CXXFLAGS += $(CXXFLAGS_$(notdir $(CXX)))
all: $(TARGETS) $(TARGETS:%=%-compliant)
$(TARGETS): %: %.o
$(CXX) $(CXXFLAGS) -o $@ $*.o $(LIBS)
$(TARGETS:%=%-compliant): %: %.o
$(CXX) $(CXXFLAGS) -o $@ $*.o $(LIBS)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -MD -MF .$*.d -c $*.cpp
%-compliant.o: %.cpp
$(CXX) $(CXXFLAGS) -DBOOST_TYPEOF_COMPLIANT -MD -MF .$*-compliant.d -o $*-compliant.o -c $*.cpp
%.opt.o: %.cpp
$(CXX) $(CXXFLAGS) -DASM_LIST -fomit-frame-pointer -O3 -MD -MF .$*.opt.d -o $*.opt.o -c $*.cpp
%.i: %.cpp __ALWAYS__
$(CXX) -E $(CPPFLAGS) $*.cpp | astyle --style=ansi | sed '/^# [0-9]/d' > $@
%-compliant.i: %.cpp __ALWAYS__
$(CXX) -E $(CPPFLAGS) -DBOOST_TYPEOF_COMPLIANT $*.cpp | astyle --style=ansi | sed '/^# [0-9]/d' > $@
%.asm: %.o
objdump -rdSC $*.o > $@
%.lst: %.opt.o
objdump -rdSC $*.opt.o > $@
DEPEND_FILES := $(wildcard .*.d)
.PHONY: __ALWAYS__
ifdef DEPEND_FILES
include $(DEPEND_FILES)
endif
CLEANFILES += $(TARGETS)
CLEANFILES += $(TARGETS:%=%-compliant)
CLEANFILES += $(SOURCES:%.cpp=%.o)
CLEANFILES += $(SOURCES:%.cpp=%.opt.o)
CLEANFILES += $(SOURCES:%.cpp=%-compliant.o)
CLEANFILES += $(SOURCES:%.cpp=%.lst)
CLEANFILES += $(SOURCES:%.cpp=%.asm)
CLEANFILES += $(SOURCES:%.cpp=%.i)
CLEANFILES += $(SOURCES:%.cpp=%-compliant.i)
CLEANFILES += $(DEPEND_FILES)
CLEANFILES := $(wildcard $(CLEANFILES))
clean:
ifdef CLEANFILES
rm -f $(CLEANFILES)
endif
#
# All the crazy templating makes the compiler use lots of RAM, so no
# parallel make for us.
#
.NOTPARALLEL: