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