-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
41 lines (30 loc) · 1.07 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
# Makefile layout originally developed by Bill Lynch
SOURCES := $(sort $(wildcard src/*.cpp src/*.cu src/*.cc src/*.c))
OBJECTS := $(sort $(patsubst src/%, obj/%.o, $(SOURCES)))
DEPENDS := $(sort $(patsubst src/%, obj/%.d, $(SOURCES)))
#
CPPFLAGS += -I./inc
LDFLAGS += -larmadillo
LDFLAGS +=
CXX := g++ -Wall -g
bin/msvr.x: $(OBJECTS)
$(CXX) -o $@ $^ $(LDFLAGS)
clean:
rm -rf bin obj html latex
obj/%.cpp.o: src/%.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
obj/%.cc.o: src/%.cc
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
obj/%.c.o: src/%.c
$(CXX) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
obj/%.cpp.d: src/%.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MM -MT "$(strip $(patsubst %.d, %.o, $@) $@)" $< -o $@
obj/%.cc.d: src/%.cc
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MM -MT "$(strip $(patsubst %.d, %.o, $@) $@)" $< -o $@
obj/%.c.d: src/%.c
$(CXX) $(CPPFLAGS) $(CFLAGS) -MM -MT "$(strip $(patsubst %.d, %.o, $@) $@)" $< -o $@
# Create system layout for Objects and binaries
ifneq ($(MAKECMDGOALS),clean)
$(shell mkdir -p bin obj)
-include $(DEPENDS)
endif