forked from SimonCahill/isotp-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (51 loc) · 1.35 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
54
55
56
57
58
59
60
61
62
63
64
65
include vars.mk
CFLAGS := -Wall -g -ggdb $(STD)
LDFLAGS := -shared
BIN := ./bin
.PHONY: all clean fPIC no_opt $(BIN)/$(LIB_NAME) $(BIN)/$(LIB_NAME).$(MAJOR_VER) $(BIN)/$(LIB_NAME).$(MAJOR_VER).$(MINOR_VER).$(REVISION) travis
###
# BEGIN TARGETS
###
###
# Builds all library artifacts
###
all: $(BIN)/$(LIB_NAME)
@printf "########## BUILT $^ ##########\n\n\n"
fPIC: CFLAGS += "-fPIC"
travis: fPIC all
###
# Builds all targets w/o optimisations enabled
###
no_opt: CFLAGS += -g -O0 all
###
# Removes all build artifacts
###
clean:
-rm -f *.o $(BIN)/$(LIB_NAME)*
###
# Builds all library artifacts, including all symlinks.
###
$(BIN)/$(LIB_NAME): $(BIN)/$(LIB_NAME).$(MAJOR_VER)
-ln -s $^ $@
@printf "Linked $^ --> $@...\n"
###
# Builds the shared object along with one symlink
###
$(BIN)/$(LIB_NAME).$(MAJOR_VER): $(BIN)/$(LIB_NAME).$(MAJOR_VER).$(MINOR_VER).$(REVISION)
-ln -s $^ $@
@printf "Linked $^ --> $@...\n"
$(BIN)/$(LIB_NAME).$(MAJOR_VER).$(MINOR_VER).$(REVISION): libisotp.o
if [ ! -d $(BIN) ]; then mkdir $(BIN); fi;
${COMP} $^ -o $@ ${LDFLAGS}
###
# Compiles the isotp.c TU to an object file.
###
libisotp.o: isotp.c
${COMP} -c $^ -o $@ ${CFLAGS} -DISO_TP_FRAME_PADDING
install: all
@printf "Installing $(LIB_NAME) to $(INSTALL_DIR)...\n"
cp $(BIN)/$(LIB_NAME)* $(INSTALL_DIR)
@printf "Library was installed...\n"
###
# END TARGETS
###