1 # XScreenSaver for MacOS X, Copyright (c) 2006-2012 by Jamie Zawinski.
3 XCODEBUILD = /usr/bin/xcodebuild
4 TARGETS = -target "All Savers"
5 ARCH = -arch i386 -arch x86_64
6 CERT = 'Jamie Zawinski'
7 CERT = 'iPhone Developer: Jamie Zawinski (Y5M82TL69N)'
8 THUMBDIR = $(HOME)/www/xscreensaver/screenshots/
15 # cd ..; $(XCODEBUILD) -target $(TARGETS) clean
18 -rm -f config.status config.cache config.log \
19 *.bak *.rej TAGS *~ "#"*
20 -rm -rf autom4te*.cache
23 distdepend:: update_plist_version
26 cd ..; $(XCODEBUILD) $(ARCH) $(TARGETS) -configuration Debug build
29 cd ..; $(XCODEBUILD) $(ARCH) $(TARGETS) -configuration Release build
31 release:: check_versions
32 release:: update_thumbs
36 @for f in build/Release/*.{saver,app} ; do \
37 codesign -vfs $(CERT) $$f ; \
42 SRC=../utils/version.h ; \
43 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
46 for S in $$DIR/*.{saver,app} ; do \
47 for P in $$S/Contents/Info.plist ; do \
48 V2=`perl -0000 -n -e \
49 'm@<key>CFBundleVersion</key>\s*<string>(.*?)</string>@si \
50 && print $$1' < $$P` ; \
51 if [ "$$V2" != "$$V" ] ; then \
52 echo "Wrong version: $$S ($$V2)" ; \
57 if [ "$$RESULT" = 0 ]; then echo "Versions match ($$V2)" ; fi ; \
61 ./update-thumbnail.pl $(THUMBDIR) build/Release/*.saver
65 ios_function_tables.h::
66 @./build-fntable.pl build/Debug-iphoneos/XScreenSaver.app $@
71 \( \( -name '.??*' -o -name build -o -name CVS -o -name '*~*' \
80 SRC=../utils/version.h ; \
81 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
83 for S in XScreenSaver.plist SaverRunner.plist iSaverRunner.plist ; do \
84 /bin/echo -n "Updating version number in $$S to \"$$V\"... " ; \
85 KEYS="CFBundleVersion|CFBundleShortVersionString" ; \
87 "s@(<key>($$KEYS)</key>\s*<string>)[^<>]+(</string>)@\$${1}$$V\$${3}@g" \
89 if cmp -s $$S $$T ; then \
99 # -format UDBZ saves 4% (~1.2 MB) over UDZO.
100 dmg:: distdepend check_versions
103 SRC=../utils/version.h ; \
104 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
106 SRC="build/Release" ; \
107 EXTRAS=../../xdaliclock/OSX/build/Release/*.saver ; \
108 BASE="xscreensaver-$$V" ; \
109 OUTDIR="../archive" ; \
110 DMG="$$OUTDIR/$$BASE.dmg" ; \
111 TMPDMG="$$TMPDIR/tmp.dmg" ; \
112 VOLNAME="XScreenSaver $$V" ; \
113 STAGE="$$TMPDIR/dmg_stage" ; \
116 echo + mkdir "$$STAGE" ; \
119 retired=`perl -0 -ne \
120 's/\\\\\\n//g; m/^RETIRED_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
121 ../hacks/Makefile.in ; \
123 's/\\\\\\n//g; m/^RETIRED_GL_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
124 ../hacks/glx/Makefile.in ; \
125 echo xscreensaver ; \
126 echo savertester` ; \
128 for f in $$SRC/*.{saver,app} $$EXTRAS ; do \
130 ff=`echo $$f | perl -e '$$_=<>; s@^.*/(.*)\..*$$@\L$$1@; print'`; \
131 for r in $$retired ; do \
132 if [ "$$ff" = "$$r" ]; then ok=no ; fi ; \
134 if [ "$$ok" = yes ]; then \
135 echo + cp -pr "$$f" "$$STAGE/" ; \
136 cp -pr "$$f" "$$STAGE/" ; \
138 echo skipping "$$f" ; \
142 cp -p bindist.rtf "$$STAGE/ READ ME.rtf" ; \
143 cp -p bindist-DS_Store "$$STAGE/.DS_Store" ; \
144 cp -p XScreenSaverDMG.icns "$$STAGE/.VolumeIcon.icns" ; \
145 /Developer/Tools/SetFile -a C "$$STAGE" ; \
146 /Developer/Tools/SetFile -a E "$$STAGE/ READ ME.rtf" ; \
147 seticon -d ../../xdaliclock/OSX/daliclockSaver.icns $$STAGE/DaliClock.saver;\
148 hdiutil makehybrid -quiet -ov -hfs -hfs-volume-name "$$VOLNAME" \
149 -hfs-openfolder "$$STAGE" "$$STAGE" -o "$$TMPDMG" ; \
151 hdiutil convert -quiet -ov -format UDBZ -imagekey zlib-level=9 \
152 "$$TMPDMG" -o "$$DMG" ; \
156 # Adding this is cute:
157 # hdiutil internet-enable -yes -quiet "$$DMG"
158 # but means that nobody will ever see the display settings I used!
159 # When finder copies the .dmg to a folder, it doesn't preserve them.