]> mj.ucw.cz Git - libucw.git/blob - build/Maketop
4058e2f25314060d0a2365bd5efa268f23888485
[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_DIR=cf
20 TESTS=
21 EXTRA_RUNDIRS=tmp log
22 INSTALL_RUNDIRS=bin lib
23 API_INCLUDES=
24 API_LIBS=
25
26 # Various files whose type does not fit into PROGS
27 DATAFILES=
28
29 ifdef CONFIG_SHARED
30 LS=so
31 OS=oo
32 else
33 LS=a
34 OS=o
35 endif
36
37 ifdef CONFIG_DARWIN
38 SOEXT=bundle
39 else
40 SOEXT=so
41 endif
42
43 # Whenever "make -s" (silent) is run, turn on verbose mode (paradoxical, but gives the right result)
44 ifneq ($(findstring s,$(MAKEFLAGS)),)
45 V=1
46 endif
47
48 # Define M (message) and Q (quiet command prefix) macros and also MAKESILENT passed to sub-makes
49 ifeq ($(V),1)
50 M=@\#
51 Q=
52 MAKESILENT=
53 else
54 M=@echo #
55 Q=@
56 MAKESILENT=-s
57 endif
58
59 # Clean needs to be a double-colon rule since we want sub-makefiles to be able
60 # to define their own cleanup actions.
61 dust::
62         rm -f `find . -path "*~" -or -name "\#*\#" -or -name core`
63         rm -f allocs.tmp cscope.out TAGS
64
65 clean:: dust
66         rm -rf `find obj/ucw -mindepth 1 -maxdepth 1 -not -name autoconf.h`
67         rm -rf `find obj -mindepth 1 -maxdepth 1 -not \( -name config.mk -o -name autoconf.h -o -name ucw \)`
68         rm -rf tests run/{bin,lib,include,.tree-stamp}
69
70 distclean:: clean
71         rm -rf obj run
72
73 testclean::
74         rm -f `find obj -name "*.test"`
75
76 docclean::
77         rm -f $(DOCS) $(patsubst %.html,%.txt,$(DOCS))
78
79 # Extra default rules (appended to by submakefiles)
80 extras::
81
82 # Relative symlinks and other pathname manipulation macros
83 empty:=
84 space:=$(empty) $(empty)
85 backref=$(subst $(space),/,$(patsubst %,..,$(subst /,$(space),$(1))))
86 tack-on=$(if $(patsubst /%,,$(2)),$(1)/$(2),$(2))
87 symlink=ln -sf $(call tack-on,$(call backref,$(2)),$(1)) $(2)/
88 symlink-alias=ln -sf $(call tack-on,$(call backref,$(2)),$(1)) $(2)/$(3)