1version = $(strip $(shell cat ../../VERSION))
2library_zip = $(launcher_dir)/library.zip
3python_dir = $$LOCALAPPDATA/Programs/Python/Python36
4python = $(python_dir)/python.exe
5qt_dir = $(python_dir)/Lib/site-packages/PyQt5/Qt
6arch = $(strip $(shell $(python) ../arch.py))
7launcher_dir = Launcher/Windows/$(arch)
8launcher_zip = fs-uae-launcher_$(version)_windows_$(arch).zip
9launcher_txz = fs-uae-launcher_$(version)_windows_$(arch).tar.xz
10
11
12all: clean progdir zip
13
14clean:
15	rm -Rf fs-uae-launcher-*_windows*
16	rm -Rf fs-uae-launcher_*_windows*
17	rm -Rf $(launcher_dir)
18	rm -Rf Launcher
19	rm -f *.tmp
20
21progdir:
22	rm -Rf Launcher
23
24	make -C ../..
25	rm -Rf ../build
26
27	cd ../.. && PYTHONHASHSEED=1 $(python) setup.py build_exe
28	mkdir -p $(launcher_dir)
29	mv ../../build/exe.win-amd64-3.6/* $(launcher_dir)
30
31	mkdir $(launcher_dir)/imageformats
32	cp $(qt_dir)/plugins/imageformats/qico.dll $(launcher_dir)/imageformats
33	cp $(qt_dir)/plugins/imageformats/qjpeg.dll $(launcher_dir)/imageformats
34	mkdir $(launcher_dir)/platforms
35	cp $(qt_dir)/plugins/platforms/qwindows.dll $(launcher_dir)/platforms
36
37	mkdir -p Launcher/Data
38	cp -a ../../share/locale Launcher/Data/Locale
39	cp ../../cacert.pem Launcher/Data
40	rm -Rf $(launcher_dir)/share/applications
41	rm -Rf $(launcher_dir)/share/icons
42
43	rm -Rf $(launcher_dir)/amitools
44	rm -Rf $(launcher_dir)/arcade
45	rm -Rf $(launcher_dir)/fsbc
46	rm -Rf $(launcher_dir)/fsgs
47	rm -Rf $(launcher_dir)/fspy
48	rm -Rf $(launcher_dir)/fstd
49	rm -Rf $(launcher_dir)/fsui
50	rm -Rf $(launcher_dir)/launcher
51	rm -Rf $(launcher_dir)/OpenGL
52	rm -Rf $(launcher_dir)/oyoyo
53	rm -Rf $(launcher_dir)/workspace
54
55	zip -d $(library_zip) amitools/\*
56	zip -d $(library_zip) arcade/\*
57	zip -d $(library_zip) fsbc/\*
58	zip -d $(library_zip) fsgs/\*
59	zip -d $(library_zip) fspy/\*
60	zip -d $(library_zip) fstd/\*
61	zip -d $(library_zip) fsui/\*
62	zip -d $(library_zip) launcher/\*
63	zip -d $(library_zip) OpenGL/\*
64	zip -d $(library_zip) oyoyo/\*
65	zip -d $(library_zip) workspace/\*
66
67	# This file differs between each build
68	zip -d $(library_zip) BUILD_CONSTANTS.pyc
69	# Remove wrong-cased members from the archive
70	zip -d $(library_zip) ConfigParser.pyc || true
71	zip -d $(library_zip) Queue.pyc || true
72	PYTHONPATH=../.. python3 -m fspy.zipfile deterministic \
73		--fix-pyc-timestamps $(library_zip)
74
75	make -C ../python
76	mkdir -p Launcher/Python
77	cp -a ../python/*.zip Launcher/Python
78
79	echo $(ver) > Launcher/Version.txt
80	echo $(ver) > $(launcher_dir)/Version.txt
81
82	python3 sign.py $(launcher_dir)/fs-uae-launcher.exe
83
84zip:
85	# cd $(launcher_dir) && zip -9 -r ../../../$(launcher_zip) *
86	zip -9 -r ../../$(launcher_zip) Launcher
87
88tar.xz: progdir
89	# cd $(launcher_dir) && tar cfvJ ../../../$(launcher_txz) *
90	tar cfvJ ../../$(launcher_txz) Launcher
91
92setup:
93	sed s/9.8.7/${version}/g fs-uae-launcher.iss > fs-uae-launcher.iss2.tmp
94	sed s/ARCH/${arch}/g fs-uae-launcher.iss2.tmp > fs-uae-launcher.iss.tmp
95	python3 iscc.py fs-uae-launcher.iss.tmp
96	python3 sign.py ../fs-uae-launcher_$(version)_windows_$(arch).exe
97	rm fs-uae-launcher.iss.tmp
98