-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.mk
63 lines (48 loc) · 1.33 KB
/
build.mk
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
# ============================================================================
# Generic build targets and recipes for xchange.
#
# You can include this in your Makefile also.
# Regular object files
$(OBJ)/%.o: %.c $(OBJ) Makefile
$(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $<
# Share library recipe
$(LIB)/%.so.$(SO_VERSION):
@make $(LIB)
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $^ -shared -fPIC -Wl,-soname,$(subst $(LIB)/,,$@) $(LDFLAGS)
# Unversioned shared libs (for linking against)
$(LIB)/lib%.so:
@rm -f $@
ln -sr $< $@
# Static library: *.a
$(LIB)/%.a:
@make $(LIB)
ar -rc $@ $^
ranlib $@
# Create sub-directories for build targets
$(OBJ) $(LIB) $(BIN) apidoc:
mkdir $@
# Remove intermediate files locally
.PHONY: clean-local
clean-local:
rm -rf obj
# Remove all locally built files, effectively restoring the repo to its
# pristine state
.PHONY: distclean-local
distclean-local: clean-local
rm -rf bin lib apidoc
# Remove intermediate files (general)
.PHONY: clean
clean: clean-local
# Remove intermediate files (general)
.PHONY: distclean
distclean: distclean-local
# Static code analysis using 'cppcheck'
.PHONY: check
check:
@echo " [check]"
@cppcheck $(CPPFLAGS) $(CHECKOPTS) src
# Doxygen documentation (HTML and man pages) under apidocs/
.PHONY: dox
dox: README.md Doxyfile apidoc $(SRC) $(INC)
@echo " [doxygen]"
@$(DOXYGEN)