-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
36 lines (29 loc) · 929 Bytes
/
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
SOURCES=csvparser.cpp tst_csv.cpp simplecsv.cpp
EXEC=tst_csv
LIBS=
CPPFLAGS=-O3 -funroll-all-loops -finline-functions -Wall
#CPPFLAGS+=-std=c++0x
#CPPFLAGS+=-DNDEBUG
OBJECTS=$(patsubst %.c,$(PREFIX)%$(SUFFIX).o,\
$(patsubst %.cpp,$(PREFIX)%$(SUFFIX).o,\
$(SOURCES)))
DEPENDS=$(patsubst %.c,$(PREFIX)%$(SUFFIX).d,\
$(patsubst %.cpp,$(PREFIX)%$(SUFFIX).d,\
$(filter-out %.o,""\
$(SOURCES))))
all: $(EXEC)
ifneq "$(MAKECMDGOALS)" "clean"
-include $(DEPENDS)
endif
clean:
rm -f $(EXEC) $(OBJECTS) $(DEPENDS)
%.d: %.c
@$(SHELL) -ec '$(CXX) -MM $(CPPFLAGS) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@;\
[ -s $@ ] || rm -f $@'
%.d: %.cpp
@$(SHELL) -ec '$(CXX) -MM $(CPPFLAGS) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@;\
[ -s $@ ] || rm -f $@'
$(EXEC): $(OBJECTS)
$(CXX) -o $@ $^ $(LIBS)