-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathMakefile
42 lines (30 loc) · 774 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
37
38
39
40
41
TARGETS=socketcan-raw-demo socketcan-bcm-demo socketcan-cyclic-demo
SRCDIR=src
# Compiler setup
CXX=g++
CPPFLAGS=-Isrc
CXXFLAGS=-std=gnu++14 -pedantic -Wall -Wextra
LIBS=
# Programs
RM=rm -f
# Rules
.PHONY: all debug clean rebuild
all: CPPFLAGS+=-DNDEBUG
all: CXXFLAGS+=-O3
all: $(TARGETS)
debug: CXXFLAGS+=-g
debug: $(TARGETS)
socketcan-raw-demo: $(SRCDIR)/socketcan-raw-demo.o
$(CXX) -o $@ $^ $(LIBS)
socketcan-bcm-demo: $(SRCDIR)/socketcan-bcm-demo.o $(SRCDIR)/util.o
$(CXX) -o $@ $^ $(LIBS)
socketcan-cyclic-demo: $(SRCDIR)/socketcan-cyclic-demo.o
$(CXX) -o $@ $^ $(LIBS)
%.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) $(SRCDIR)/*.o
$(RM) socketcan-raw-demo
$(RM) socketcan-bcm-demo
$(RM) socketcan-cyclic-demo
rebuild: clean all