-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
54 lines (40 loc) · 1.14 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
42
43
44
45
46
47
48
49
50
51
52
53
# Makefile targets:
#
# all/install build and install the NIF
# clean clean build products and intermediates
#
# Variables to override:
#
# MIX_APP_PATH path to the build directory
#
# CC C compiler
# CXX C++ compiler
# CROSSCOMPILE crosscompiler prefix, if any
# CXXFLAGS compiler flags for compiling all C++ files
# LDFLAGS linker flags for linking all binaries
CXXFLAGS :=
LDFLAGS ?= $(shell pkg-config --cflags --libs libusb-1.0)
SRC = $(wildcard src/*cpp)
HEADERS = $(wildcard src/*.h)
OBJ = $(SRC:src/%.cpp=$(BUILD)/%.o) $(BUILD)/J2534.o
BUILD := _build
PREFIX := out
BIN := ecudump
all: install
install: $(PREFIX) $(BUILD) $(BIN)
$(OBJ): $(HEADERS) Makefile
$(BUILD)/J2534.o: J2534/J2534.cpp
$(CXX) -c -IJ2534 $(CXXFLAGS) -o $(BUILD)/J2534.o J2534/J2534.cpp
$(BUILD)/%.o: src/%.cpp
@echo " CXX $(notdir $@)"
$(CXX) -c -Ilib/j2534/j2534 -IJ2534 $(CXXFLAGS) -o $@ $<
$(BIN): $(OBJ)
@echo " LD $(notdir $@)"
$(CXX) -o $@ $(LDFLAGS) -Llib/j2534/j2534/ $^
$(PREFIX) $(BUILD):
mkdir -p $@
clean:
$(RM) $(BIN) $(OBJ)
.PHONY: all clean install
# Don't echo commands unless the caller exports "V=1"
${V}.SILENT: