-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbuild.mk
More file actions
66 lines (48 loc) · 1.46 KB
/
build.mk
File metadata and controls
66 lines (48 loc) · 1.46 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
55
56
57
58
59
60
61
62
# ============================================================================
# Generic build targets and recipes for SuperNOVAS.
#
# 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 recipe
$(LIB)/%.a:
@$(MAKE) $(LIB)
ar -rc $@ $^
ranlib $@
# Create sub-directories for build targets
$(OBJ) $(LIB) $(BIN):
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
CHECK_DIR ?= .
# Static code analysis using 'cppcheck'
.PHONY: analyze
analyze:
@echo " [analyze]"
@cppcheck $(CPPFLAGS) -DCPPCHECK=1 $(CHECKOPTS) $(CHECK_DIR)
# Static code analysis viacat Facebook's infer
.PHONY: infer
infer: clean
infer run -- $(MAKE) shared