-somewhat more elegant method, supporting the src subdir (-Markus)
[wxWidgets.git] / Makefile
1 # Top-level Makefile for wxGTK by Wolfram Gloger
2 # based on the version for wx-Xt by Martin Sperl
3
4 SHELL=/bin/sh
5
6 #if DIRS are defind make only executes in these diretories
7 all::
8 @if test "x$(DIRS)" = x; then \
9 for i in src samples utils user; do \
10 echo "entering directory $$i building $@"; \
11 (cd $$i; ${MAKE} -k $@); \
12 done; \
13 else \
14 for i in $(DIRS) xxx; do \
15 if test "$$i" != xxx; then \
16 echo "entering directory $$i building $@"; \
17 (cd $$i; ${MAKE} -k $@); \
18 fi; \
19 done; \
20 fi
21
22 # what to do if a target is not understood:
23 # pass it on to all the children...
24
25 .DEFAULT::
26 @if test "x$(DIRS)" = x; then \
27 for i in src samples utils user; do \
28 echo "entering directory $$i building $@"; \
29 (cd $$i; ${MAKE} -k $@); \
30 done; \
31 else \
32 for i in $(DIRS) xxx; do \
33 if test "$$i" != xxx; then \
34 echo "entering directory $$i building $@"; \
35 (cd $$i; ${MAKE} -k $@); \
36 fi; \
37 done; \
38 fi
39
40 src::
41 @echo "entering directory src building all"
42 @cd src; ${MAKE} all
43
44 samples::
45 @echo "entering directory samples building all"
46 @cd samples; ${MAKE} all
47
48 utils::
49 @echo "entering directory utils building all"
50 @cd utils; ${MAKE} all
51
52 user::
53 @echo "entering directory user building all"
54 @cd user; ${MAKE} all
55
56 # the following ones recreate all Makefiles.
57
58 makefiles:: recreate
59 Makefiles:: recreate
60 recreate::
61 @install/unix/setup/general/createall
62
63 # the following ones define what needs to be done to distribute the
64 # library and its components
65
66 distribute:: distrib
67 distrib:: distrib_base distrib_user join_utils join_samples
68
69 distrib_samples::
70 @echo "entering directory samples creating distribution files"
71 @(cd samples; ${MAKE} -k distrib)
72
73 distrib_user::
74 @echo "entering directory user creating distribution files"
75 @(cd user; ${MAKE} -k distrib)
76
77 distrib_utils::
78 @echo "entering directory utils creating distribution files"
79 @(cd utils; ${MAKE} -k distrib)
80
81 join_utils:: distrib_utils
82 @$(MAKE) join \
83 BASEDIR=utils \
84 FILES=`echo distrib/utils/*.tgz `
85
86 join_samples:: distrib_samples
87 @$(MAKE) join \
88 BASEDIR=samples \
89 FILES=`echo distrib/samples/*.tgz `
90
91 join_user:: distrib_user
92 @$(MAKE) join \
93 BASEDIR=user \
94 FILES=`echo distrib/user/*.tgz `
95
96 join::
97 @# needed are BASEDIR and FILES
98 @if test "x$$BASEDIR" = x; then\
99 echo "BASEDIR not specified.";\
100 exit -1;\
101 fi
102 @if test "x$$FILES" != x ; then \
103 echo "putting all seperate distribution files:";\
104 echo "$$FILES";\
105 echo "into distrib/$(BASEDIR).tgz";\
106 src/gtk/setup/general/jointar $(BASEDIR) $$FILES distrib/$(BASEDIR).tgz; \
107 else \
108 echo "Nothing to join - deleting..."; \
109 echo "This may be the case, if you have not specified FILES."\
110 rm -f distrib/$(BASEDIR).tgz; \
111 fi
112
113 distrib_base::
114 @if test ! -d distrib ; then mkdir distrib; fi;
115 @if test ! -f system.list ; then \
116 echo "dummy" > system.list;\
117 fi
118 @(curr=`pwd`; direc=`basename $$curr`;\
119 (cd ..; \
120 echo creating distrib/$$direc.tar from the current directory;\
121 tar -cf /tmp/$$direc.tar \
122 $$direc/COPYING\
123 $$direc/INSTALL\
124 $$direc/Makefile\
125 $$direc/template.mak\
126 $$direc/configure\
127 $$direc/configure.in\
128 $$direc/config.guess\
129 $$direc/config.sub\
130 $$direc/install-sh\
131 $$direc/user/Makefile \
132 $$direc/utils/Makefile \
133 $$direc/samples/Makefile \
134 ;\
135 sed "s|^\(.*\)$$|/\1/|g" $$direc/system.list \
136 | uniq > /tmp/$$direc.list; \
137 echo "/RCS/" >> /tmp/$$direc.list; \
138 for each in misc docs wx src setup; do \
139 tar -uf /tmp/$$direc.tar \
140 `\
141 find $$direc/$$each \( -type f -o -type l \) -print \
142 | fgrep -vf /tmp/$$direc.list \
143 | grep -v "[~#]$$" \
144 ` ;\
145 done; \
146 echo compressing $$direc.tar to $$direc.tgz;\
147 gzip -9 -c /tmp/$$direc.tar > $$direc/distrib/$$direc.tgz;\
148 rm /tmp/$$direc.tar /tmp/$$direc.list;\
149 )\
150 )
151
152 # the following ones are only needed if configure.in has changed
153 # and needs to be updated...
154
155 config:: configure
156
157 configure::
158 @autoconf
159 @cat configure \
160 | sed "s/config.cache/\$$OSTYPE.config.cache/g" \
161 | sed "s/config.status/\$$OSTYPE.config.status/g" \
162 | sed "s/\*\*--/ --/g" \
163 > configure1
164 @chmod a+x configure1
165 @mv configure1 configure
166
167