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