aboutsummaryrefslogtreecommitdiff
path: root/mk/lib.mk
blob: b4a2fb265c3e77e3d77915592e58f33b5f176d29 (plain)
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
default: all


# Include Autoconf variables.
template_files += Makefile.config
include Makefile.config


# Initialise some variables.
QUIET = @


# Pass -fPIC if we're building dynamic libraries.
ifeq ($(BUILD_SHARED_LIBS), 1)
  GLOBAL_CFLAGS += -fPIC
  GLOBAL_CXXFLAGS += -fPIC
  GLOBAL_LDFLAGS += -Wl,--no-copy-dt-needed-entries
endif


# Pass -g if we want debug info.
ifeq ($(BUILD_DEBUG), 1)
  GLOBAL_CFLAGS += -g
  GLOBAL_CXXFLAGS += -g
endif


include mk/clean.mk
include mk/dist.mk
include mk/install.mk
include mk/libraries.mk
include mk/programs.mk
include mk/patterns.mk
include mk/templates.mk


# Include all sub-Makefiles.
define include-sub-makefile =
  d := $$(patsubst %/, %, $$(dir $(1)))
  include $(1)
endef

$(foreach mf, $(SUBS), $(eval $(call include-sub-makefile, $(mf))))


# Instantiate stuff.
$(foreach lib, $(LIBS), $(eval $(call build-library,$(lib))))
$(foreach prog, $(PROGRAMS), $(eval $(call build-program,$(prog))))
$(foreach template, $(template_files), $(eval $(call instantiate-template,$(template))))


all: $(programs_list)