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