-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.mk
More file actions
57 lines (42 loc) · 1.24 KB
/
build.mk
File metadata and controls
57 lines (42 loc) · 1.24 KB
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
# ============================================================================
# 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) $<
# Shared library recipe
$(LIB)/%.$(SOEXT).$(SO_VERSION): | $(LIB)
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $^ $(SHARED_FLAGS) $(SONAME_FLAG)$(notdir $@) $(LDFLAGS)
# Unversioned shared libs (for linking against)
$(LIB)/lib%.$(SOEXT):
@rm -f $@
( cd $(dir $@); ln -s $(notdir $<) $(notdir $@) )
# Static library: *.a
$(LIB)/%.a:
@$(MAKE) $(LIB)
ar -rc $@ $^
ranlib $@
# Create sub-directories for build targets
$(OBJ) $(LIB) $(BIN) apidoc:
mkdir -p $@
# 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 infer-out
# Remove intermediate files (general)
.PHONY: clean
clean: clean-local
# Remove intermediate files (general)
.PHONY: distclean
distclean: distclean-local
# Static code analysis using 'cppcheck'
.PHONY: analyze
analyze:
@echo " [analyze]"
@cppcheck $(CPPFLAGS) $(CHECKOPTS) src