summaryrefslogtreecommitdiffstats
path: root/Makefile.in
blob: e0795b2f52fef72cff54a2e3cf9a9c8bb900a272 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# Makefile.in --- xscreensaver, Copyright (c) 1999-2014 Jamie Zawinski.
# the `../configure' script generates `Makefile' from this file.

@SET_MAKE@
srcdir		= @srcdir@
VPATH		= @srcdir@

SHELL		= /bin/sh
SUBDIRS 	= utils jwxyz hacks/images hacks hacks/glx driver po
SUBDIRS2	= $(SUBDIRS) OSX android
TARFILES	= README README.hacking README.VMS INSTALL \
		  configure configure.in Makefile.in config.h.in \
		  config.h-vms install-sh setup.com config.guess aclocal.m4 \
		  ax_pthread.m4 config.sub makevms.com \
		  intltool-merge.in intltool-extract.in intltool-update.in \
		  xscreensaver.spec \
		  OSX/xscreensaver.xcodeproj/project.pbxproj

TAR		= tar

# Using $(MAKE) directly means the shell executes things even with "make -n"
MAKE2 = $(MAKE)

MAKE_SUBDIR  = for dir in $(SUBDIRS); do (cd $$dir; $(MAKE2) $@) || exit 5; done
MAKE_SUBDIR2 = for dir in $(SUBDIRS2); do (cd $$dir; $(MAKE2) $@) || exit 5; done

default::
	@+$(MAKE_SUBDIR)
all::
	@+$(MAKE_SUBDIR)
install::
	@+$(MAKE_SUBDIR)
install-program::
	@+$(MAKE_SUBDIR)
install-man::
	@+$(MAKE_SUBDIR)
install-strip::
	@+$(MAKE_SUBDIR)
uninstall::
	@$(MAKE_SUBDIR)
uninstall-program::
	@$(MAKE_SUBDIR)
uninstall-man::
	@$(MAKE_SUBDIR)
depend::
	@$(MAKE_SUBDIR)
distdepend::
	@$(MAKE2) update_spec_version
	@$(MAKE_SUBDIR2)
	@cd po ; $(MAKE2) update-po

TAGS:: tags
tags::
	@$(MAKE_SUBDIR)

clean::
	@$(MAKE_SUBDIR2)

distclean:: clean
	-rm -f config.h Makefile config.status config.cache config.log TAGS *~ "#"* intltool-extract intltool-merge intltool-update
	@$(MAKE_SUBDIR2)

dist:: tar

# This really makes me sick...
tar::
	@								    \
  sh config.status ;							    \
  rm -f configure ;							    \
  $(MAKE2) configure ;							    \
  $(MAKE2) version-date distdepend ;					    \
  VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ;  \
  NAME="xscreensaver-$$VERS" ;						    \
  rm -rf $$NAME ; ln -s . $$NAME ;					    \
  FILES= ;								    \
  ADIR=archive/ ;							    \
  for subdir in $(SUBDIRS2) ; do					    \
    d=`pwd` ;								    \
    cd $$subdir ;							    \
    FILES="$$FILES `$(MAKE2) echo_tarfiles				    \
      | grep -v '^.*make\['						    \
      | sed \"s|^|$$subdir/|g;s| | $$subdir/|g\"			    \
      ` ";								    \
    cd $$d ; done ;							    \
  echo creating tar file $$ADIR$$NAME.tar.gz... ;			    \
  export COPYFILE_DISABLE=true ;					    \
  GZIP="-9v" $(TAR) -vczf $$ADIR$$NAME.tar.gz			            \
    `echo $(TARFILES) $$FILES | sed "s|^|$$NAME/|g; s| | $$NAME/|g" ` ;	    \
  rm $$NAME


# This also makes me sick...
# autoconf generates a configure script that begins with a very hard to read,
# nearly impossible to customize --help blurb.  This horrid set of regexps
# go through and clean up the help text, by inserting whitespace and ripping
# out options we don't use.  Odds are good that this will fail with any version
# of autoconf other than the ones I've tried (2.12 and 2.13.)
#
configure::
	aclocal
	autoconf
	autoheader
	@TMP=configure.$$$$ ;						     \
	echo "munging configure's --help message..." ;			     \
	( perl -e '							     \
		my $$file="";						     \
		while (<>) { $$file .= $$_; }				     \
		$$_ = $$file;						     \
									     \
		s/^(Configuration:)$$/\n$$1\n/m;			     \
		s/^(Directory and file names:)$$/\n$$1\n/m;		     \
		s/^  --sbindir=.*\n//m;					     \
		s/^  --sysconfdir.*\n//m;				     \
		s/^  --sharedstatedir.*\n.*\n//m;			     \
		s/^  --localstatedir.*\n//m;				     \
		s/^  --infodir.*\n//m;					     \
		s/^(Host type:)$$/\n$$1\n/m;				     \
		s/\nFeatures and packages:\n.*library files are in DIR\n/\n/s;\
		s/--enable and --with options recognized://m;		     \
		s/\n  --with-x .*?(["\n])/$$1/s;			     \
		s/\n(Installation options:\n)/$$1/s;			     \
									     \
		s/^  --oldincludedir=.*$$/ \
 --x-includes=DIR        X include files are in DIR\n \
 --x-libraries=DIR       X library files are in DIR/m; \
									     \
		s@mandir=.\$$\{prefix}/man.@mandir=\\\$${datadir}/man@;       \
									     \
		s@rm -f conftest@rm -rf conftest@g;			     \
									     \
		print;'							     \
	< configure							     \
	> $$TMP &&							     \
	cat $$TMP > configure ) ;					     \
	rm -f $$TMP

bump-version::
	@								    \
  SRC=utils/version.h ;							    \
  VERS=`sed -n 's/[^0-9]*\([0-9]\)\.\([0-9][^. ]*\).*/\1 \2/p' $$SRC` ;	    \
  set - $$VERS ;							    \
  MAJOR="$$1"; MINOR="$$2";						    \
  NEW=`echo $$MINOR + 1 | bc` ;						    \
  NEW=`echo $$NEW | sed 's/^\([0-9]\)$$/0\1/'` ;			    \
  D=`date '+%d-%b-%Y'`;							    \
  ADIR=archive/ ;							    \
  if [ ! -f $${ADIR}xscreensaver-$$MAJOR.$$MINOR.tar.gz ]; then		    \
   echo "WARNING: $${ADIR}xscreensaver-$$MAJOR.$$MINOR.tar.gz does not exist.";\
  fi ;									    \
  if [ -f $${ADIR}xscreensaver-$$MAJOR.$$NEW.tar.gz ]; then		    \
    echo "WARNING: $${ADIR}xscreensaver-$$MAJOR.$$NEW.tar.gz already exists.";\
  fi ;									    \
  /bin/echo -n "Bumping $$MAJOR.$$MINOR to $$MAJOR.$$NEW ($$D), ok? ";	    \
  read line;								    \
  if [ "x$$line" != "xyes" -a  "x$$line" != "xy" ]; then		    \
    exit 1 ; 								    \
  fi ;									    \
  TMP=/tmp/bv.$$ ;							    \
  sed -e "s/\([0-9]\.[0-9][0-9]*\)/$$MAJOR.$$NEW/"			    \
      -e "s/\(([0-9][0-9]*-[A-Za-z][a-z][a-z]-[0-9][0-9][0-9]*\))/($$D)/"   \
        $$SRC > $$TMP ;							    \
  /bin/echo -n "New version and date are ";				    \
  sed -n "s/[^0-9]*\([0-9]\.[0-9][0-9]*\) (\([-A-Za-z0-9]*\)).*/\1, \2./p"  \
     $$TMP;								    \
  cat $$TMP > $$SRC ;							    \
  rm -f $$TMP;								    \
  echo "overwrote $$SRC"; 						    \
  ls -lFd $$SRC

bump_version:: bump-version
tick-version:: bump-version
tick_version:: bump-version

version-date::
	@								    \
  SRC=utils/version.h ;							    \
  D=`date '+%d-%b-%Y'`;							    \
  TMP=/tmp/bv.$$ ;							    \
  sed -e "s/([0-9][^()]*)/($$D)/" < $$SRC > $$TMP ;			    \
  /bin/echo -n "Updating date in $$SRC to \"$$D\"... " ;		    \
  if cmp -s $$SRC $$TMP ; then						    \
    echo "unchanged." ;							    \
  else									    \
    cat $$TMP > $$SRC ;							    \
    echo "done." ;							    \
  fi ;									    \
  rm -f $$TMP


update_spec_version::
	@S=$(srcdir)/xscreensaver.spec ;				    \
	U=$(srcdir)/utils/version.h ;					    \
	VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' < $$U` ;	    \
	/bin/echo -n "Updating $$S to \"$$VERS\"... " ;			    \
	T=/tmp/xs.$$$$ ;						    \
	sed "s/^\(%define.version[^0-9]*\)\(.*\)/\1$$VERS/"		    \
	  < $$S > $$T ;							    \
	if cmp -s $$S $$T ; then					    \
	  echo "unchanged." ;						    \
	else								    \
	  cat $$T > $$S ;						    \
	  echo "done." ;						    \
	fi ;								    \
	rm $$T

rpm::
	@								   \
  VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ; \
  DIR=`pwd`/rpm_build ;							   \
  ARCH=`rpm --showrc | sed -n 's/^build arch *: //p'` ;			   \
  ADIR=archive/ ;							   \
  TGZ=xscreensaver-$$VERS.tar.gz ;					   \
  if [ ! -f $${ADIR}$$TGZ ]; then					   \
    echo "$${ADIR}$$TGZ does not exist!  Did you forget to \`make tar'?" ; \
    exit 1 ; 								   \
  fi ;									   \
  rm -rf /var/tmp/xscreensaver-$$VERS-root ;				   \
  rm -rf $$DIR ;							   \
  mkdir $$DIR ;								   \
  ( cd $$DIR; mkdir BUILD RPMS RPMS/$$ARCH SOURCES SPECS SRPMS ) ;	   \
  cp -p $${ADIR}$$TGZ $$DIR/SOURCES/ ;					   \
  rpmbuild --define "_topdir $$DIR"					   \
           --define "USE_GL yes"					   \
           -v -ba xscreensaver.spec ;					   \
  echo '' ;								   \
  echo 'RPM build complete' ;						   \
  echo '' ;								   \
  rm -f $$DIR/$$TGZ ;							   \
  rm -rf $$DIR/BUILD/xscreensaver-$$VERS ;				   \
  mv $$DIR/SRPMS/xscreensaver*-$$VERS-*.rpm . ;				   \
  mv $$DIR/RPMS/$$ARCH/xscreensaver*-$$VERS-*.rpm . ;			   \
  rm -rf $$DIR ;							   \
  echo '' ;								   \
  ls -lFG xscreensaver*-$$VERS-*.rpm

dmg::
	$(MAKE2) -C OSX release dmg
apk::
	$(MAKE2) -C android apk

www::
	@								    \
  DEST=$$HOME/www/xscreensaver ;					    \
  VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ;  \
  HEAD="xscreensaver-$$VERS" ;						    \
  ADIR=archive/ ;							    \
  BNAME="$$HEAD.tar.gz" ;						    \
  NAME="$$ADIR$$BNAME" ;						    \
  DNAME="$$DEST/$$HEAD.tar.gz" ;					    \
  BNAME2="$$HEAD.dmg" ;							    \
  NAME2="$$ADIR$$BNAME2" ;						    \
  DNAME2="$$DEST/$$HEAD.dmg" ;						    \
  BNAME3="$$HEAD.apk" ;							    \
  NAME3="$$ADIR$$BNAME3" ;						    \
  DNAME3="$$DEST/$$HEAD.apk" ;						    \
									    \
  if ! git diff --quiet ; then						    \
    echo "uncommitted changes exist!" ;					    \
    exit 1 ;								    \
  fi ;									    \
									    \
  $(MAKE2) -C OSX updates.xml ;						    \
									    \
  if [ ! -f $$NAME ]; then						    \
    echo "$$NAME does not exist!  Did you forget to \`make tar'?" ;	    \
    exit 1 ; 								    \
  fi ;									    \
  if [ ! -f $$NAME2 ]; then						    \
    echo "$$NAME2 does not exist!  Did you forget to \`make dmg'?" ;	    \
    exit 1 ; 								    \
  fi ;									    \
  if [ ! -f $$NAME3 ]; then						    \
    echo "$$NAME3 does not exist!  Did you forget to \`make apk'?" ;	    \
    exit 1 ; 								    \
  fi ;									    \
  chmod a-w $$NAME ;							    \
  if [ -f $$DNAME ]; then						    \
    /bin/echo -n "WARNING: $$DNAME already exists!  Overwrite? ";	    \
    read line;								    \
    if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then		    \
      exit 1 ; 								    \
    fi ;								    \
  fi ;									    \
  if [ -f $$DNAME2 ]; then						    \
    /bin/echo -n "WARNING: $$DNAME2 already exists!  Overwrite? ";	    \
    read line;								    \
    if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then		    \
      exit 1 ; 								    \
    fi ;								    \
  fi ;									    \
  if [ -f $$DNAME3 ]; then						    \
    /bin/echo -n "WARNING: $$DNAME3 already exists!  Overwrite? ";	    \
    read line;								    \
    if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then		    \
      exit 1 ; 								    \
    fi ;								    \
  fi ;									    \
									    \
  git tag -a "v$$VERS" -m "$$VERS" ;					    \
  git commit -m "$$VERS" . ;						    \
									    \
  ( cd $$DEST ;	git pull ) ;						    \
									    \
  cp -p $$NAME $$DNAME ;						    \
  cp -p $$NAME2 $$DNAME2 ;						    \
  cp -p $$NAME3 $$DNAME3 ;						    \
  chmod u+w $$DNAME $$DNAME2 $$DNAME3 ;					    \
  cp -p OSX/updates.xml $$DEST ;					    \
  cd $$DEST ;								    \
									    \
  TMP=/tmp/xd.$$$$ ;							    \
  sed "s/xscreensaver-5\.[0-9][0-9ab]*/$$HEAD/g" download.html > $$TMP ;    \
  echo '' ;								    \
  diff -U0 download.html $$TMP ;					    \
  echo '' ;								    \
									    \
  for EXT in tar.gz dmg ; do						    \
    OLDEST=`ls xscreensaver*.$$EXT | 					    \
      fgrep -v 5.14 |							    \
      fgrep -v 5.34 |							    \
      head -n 1` ;							    \
    /bin/echo -n "Delete $$DEST/$$OLDEST? ";				    \
    read line;								    \
    if [ "x$$line" = "xyes" -o "x$$line" = "xy" ]; then			    \
      set -x ;								    \
      rm $$OLDEST ;							    \
      git rm $$OLDEST ;							    \
      set +x ;								    \
    fi ;								    \
  done ;								    \
  set -x ;								    \
  cat $$TMP > download.html ;						    \
  rm -f $$TMP ;								    \
									    \
  git add $$BNAME $$BNAME2 $$BNAME3 ;					    \
									    \
  $(MAKE2) -C ../ xscreensaver/changelog.html xscreensaver/screenshots/index.html; \
  git diff changelog.html ;						    \
  set +x ;								    \
									    \
  /bin/echo -n "Ok? ";							    \
  read line;								    \
  if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then			    \
    exit 1 ;								    \
  fi ;									    \
									    \
  git tag -a "v$$VERS" -m "$$VERS" ;					    \
  git commit -m "$$VERS" . ;						    \
  git push ;								    \


count::
	@ \
  /bin/echo -n "Current hack count: " ; \
  ( ( cd hacks;     make -s INSTALL=true install-program install-scripts ) ; \
    ( cd hacks/glx; make -s INSTALL=true install-program ) ) | \
    grep true | \
    grep -v helper | \
    grep -v ljlatest | \
    wc -l