]> mj.ucw.cz Git - libucw.git/blob - build/Maketop
c57d1bec42a4bcbab1414cc9b3592f4ffffc6a01
[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) -I. -I$(o) -I$(s)
11 LDFLAGS=$(LOPT)
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
60
61 clean:: dust
62         rm -rf obj tests run/bin/* run/lib/* run/include/* run/.tree-stamp TAGS
63
64 distclean:: clean
65         rm -rf run
66
67 testclean::
68         rm -f `find obj -name "*.test"`
69
70 # Relative symlinks and other pathname manipulation macros
71 empty:=
72 space:=$(empty) $(empty)
73 backref=$(subst $(space),/,$(patsubst %,..,$(subst /,$(space),$(1))))
74 tack-on=$(if $(patsubst /%,,$(2)),$(1)/$(2),$(2))
75 symlink=ln -sf $(call tack-on,$(call backref,$(2)),$(1)) $(2)/