-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (67 loc) · 2.29 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# blog/sies toplevel makefile
# Copyright (c) Dibase Limited 2013
# Author: Ralph E. McArdell
#
# Targets:
# --------
# all (default): build all libraries and examples using
# release and debug configurations
# release: as all but only builds using release configuarion
# debug: as all but only builds using debug configuration
# test: builds test executables using debug configuration
# check: as test but also executes tests
# clean: removes all executables, libraries and object files built by make
# tidy: removes only intermediate files such as object files
# help: shows similar help text on console
ROOT_DIR = $(CURDIR)
# Set BUILD_CONFIG to valid value, but not used by this make file.
BUILD_CONFIG = release
include makeinclude.mak
.PHONY: all dirs debug release test check tidy clean help
export COMPILE_OPTS
all: debug release
# We expect these directories to be present:
dirs: $(BUILD_DIR)/debug $(BUILD_DIR)/release $(LIB_DIR) $(EXEC_DIR) $(TEST_DIR)
# $(MAKE) -C $(SRC_DIR) BUILD_CONFIG=debug
debug: dirs
$(MAKE) -C $(SRC_DIR)/apps BUILD_CONFIG=debug
# $(MAKE) -C $(SRC_DIR) BUILD_CONFIG=release
release: dirs
$(MAKE) -C $(SRC_DIR)/apps BUILD_CONFIG=release
test: dirs
$(MAKE) -C $(SRC_DIR)/tests BUILD_CONFIG=debug
check: dirs test
@echo 'To be done...'
tidy: dirs
$(MAKE) -C $(SRC_DIR) tidy
$(MAKE) -C $(SRC_DIR)/tests tidy
$(MAKE) -C $(SRC_DIR)/apps tidy
clean: dirs
$(MAKE) -C $(SRC_DIR) clean
$(MAKE) -C $(SRC_DIR)/tests clean
$(MAKE) -C $(SRC_DIR)/apps clean
help:
@echo 'Usage: make [target]'
@echo 'Targets:'
@echo ' all (default) Build release and debug targets.'
@echo ' release Build release library and example executables.'
@echo ' debug Build debug library and example executables.'
@echo ' test Build tests.'
@echo ' check Build test and execute tests.'
@echo ' clean Remove final and intermediate targets.'
@echo ' tidy Remove only intermediate targets such as .o files.'
@echo ' help Print this help.'
# The following rules ensure we have the varous end
# and intermediate target directories available:
$(EXEC_DIR):
mkdir $@
$(TEST_DIR):
mkdir $@
$(LIB_DIR):
mkdir $@
$(BUILD_DIR):
mkdir $@
$(BUILD_DIR)/debug: $(BUILD_DIR)
mkdir $@
$(BUILD_DIR)/release: $(BUILD_DIR)
mkdir $@