-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (22 loc) · 670 Bytes
/
Copy pathMakefile
File metadata and controls
32 lines (22 loc) · 670 Bytes
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
objects = src/main.o src/dfu.o
CXXFLAGS += -std=c++17 -O1 -g -fno-omit-frame-pointer
LDFLAGS += -g
LIBUSB_CFLAGS = $(shell pkg-config --cflags libusb-1.0)
LIBUSB_LDFLAGS = $(shell pkg-config --libs libusb-1.0)
CXXFLAGS += $(LIBUSB_CFLAGS)
LDFLAGS += $(LIBUSB_LDFLAGS)
ifdef ASAN
CXXFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address
endif
all: dfu
dfu: $(objects)
$(CXX) -o dfu $(objects) $(LDFLAGS)
%.o.json: %.cpp
clang++ -MJ $@ $(CXXFLAGS) -c $<
src/main.o src/dfu.o: src/dfu.h
compile_commands.json: $(objects:.o=.o.json)
sed -e '1s/^/[\'$$'\n''/' -e '$$s/,$$/\'$$'\n'']/' $^ > compile_commands.json
.PHONY: clean
clean:
-rm -f dfu $(objects)