]> mj.ucw.cz Git - libucw.git/blob - build/Maketop
XTypes: Added support to configuration and option parser.
[libucw.git] / build / Maketop
1 # Top part of Makefile for the UCW Libraries
2 # (c) 1997--2008 Martin Mares <mj@ucw.cz>
3
4 # Set to 1 if you want verbose output
5 V=0
6
7 # Set to 'y' (or 'n') if you want to auto-confirm (auto-reject) all questions in build/installer
8 CONFIRM=
9
10 # Disable all built-in rules and variables. Speeds up make and simplifies debugging.
11 MAKEFLAGS+=-rR
12
13 CFLAGS=$(CLANG) $(COPT) $(CDEBUG) $(CWARNS) $(CEXTRA) -I. -I$(o) -I$(s)
14 LDFLAGS=$(LOPT) $(LEXTRA)
15
16 DIRS=
17 PROGS=
18 CONFIGS=
19 CONFIG_SRC_DIR=$(CONFIG_DIR)
20 TESTS=
21 EXTRA_RUNDIRS=tmp log
22 INSTALL_RUNDIRS=bin lib
23 API_INCLUDES=
24 API_LIBS=
25
26 DOCS=
27 DOC_INDICES=
28 MANPAGES=
29
30 # Various files whose type does not fit into PROGS
31 DATAFILES=
32
33 ifdef CONFIG_DARWIN
34 DYNAMIC_LIBRARIES=dylib
35 SOEXT=bundle
36 HOST_PREFIX=/sw
37 else
38 DYNAMIC_LIBRARIES=so
39 SOEXT=so
40 HOST_PREFIX=
41 endif
42
43 ifdef CONFIG_SHARED
44 LS=$(DYNAMIC_LIBRARIES)
45 OS=oo
46 PKG_CONFIG_OPTS=
47 else
48 LS=a
49 OS=o
50 PKG_CONFIG_OPTS=--static
51 endif
52 LV=$(UCW_ABI_SUFFIX)
53
54 SO_RUNDIR=lib
55
56 # Whenever "make -s" (silent) is run, turn on verbose mode (paradoxical, but gives the right result)
57 ifneq ($(findstring s,$(MAKEFLAGS)),)
58 V=1
59 endif
60
61 # Define M (message) and Q (quiet command prefix) macros and also MAKESILENT passed to sub-makes
62 ifeq ($(V),1)
63 M=@\#
64 Q=
65 MAKESILENT=
66 else
67 M=@echo #
68 Q=@
69 MAKESILENT=-s
70 endif
71
72 # Clean needs to be a double-colon rule since we want sub-makefiles to be able
73 # to define their own cleanup actions.
74 dust::
75         rm -f `find . -path "*~" -or -name "\#*\#"`
76         rm -f allocs.tmp cscope.out TAGS
77
78 clean:: dust
79         rm -rf `find obj/ucw -mindepth 1 -maxdepth 1 -not -name autoconf.h`
80         rm -rf `find obj -mindepth 1 -maxdepth 1 -not \( -name config.mk -o -name autoconf.h -o -name ucw \)`
81         rm -rf tests run/{bin,lib,include,.tree-stamp,doc}
82
83 distclean:: clean
84         rm -rf obj run debian-tmp
85
86 testclean::
87         rm -f `find obj -name "*.test"`
88
89 docclean::
90         rm -f $(DOCS) $(patsubst %.html,%.txt,$(DOCS))
91
92 # Extra default rules (appended to by submakefiles)
93 extras::
94
95 # Relative symlinks and other pathname manipulation macros
96 empty:=
97 space:=$(empty) $(empty)
98 backref=$(subst $(space),/,$(patsubst %,..,$(subst /,$(space),$(1))))
99 tack-on=$(if $(patsubst /%,,$(2)),$(1)/$(2),$(2))
100 symlink=ln -sf $(call tack-on,$(call backref,$(2)),$(1)) $(2)/
101 symlink-alias=ln -sf $(call tack-on,$(call backref,$(2)),$(1)) $(2)/$(3)