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