implement MEDIAN (untested)
[pspp] / Windows / automake.mk
1 #   Copyright (C) 2021 John Darrington
2 #
3 #   This program is free software: you can redistribute it and/or modify
4 #   it under the terms of the GNU General Public License as published by
5 #   the Free Software Foundation, either version 3 of the License, or
6 #   (at your option) any later version.
7 #
8 #   This program is distributed in the hope that it will be useful,
9 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #   GNU General Public License for more details.
12 #
13 #   You should have received a copy of the GNU General Public License
14 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 EXTRA_DIST+=Windows/build-dependencies \
17 Windows/AdvUninstLog.nsh \
18 Windows/MUI_EXTRAPAGES.nsh \
19 Windows/README \
20 Windows/pspp.nsi
21
22 nsis_installer_deps=$(DESTDIR)$(prefix)/share/doc/pspp/pspp.html \
23         $(DESTDIR)$(prefix)/share/doc/pspp/pspp.pdf \
24         Windows/AdvUninstLog.nsh Windows/MUI_EXTRAPAGES.nsh
25
26 environment_dir = $$(echo $(LDFLAGS) | $(SED) -e 's/^-L//' -e 's|/lib$$||')
27 libgcc_dir = $$(dirname $$($(CC) -print-libgcc-file-name))
28
29 # Note that install is a PHONY target.  Therefore this rule is always executed.
30 Windows/nsis-bin: install
31         @$(RM) -r $@
32         @$(MKDIR_P) $@
33         cp $(DESTDIR)$(prefix)/bin/* $@
34         cp `$(CC) -print-file-name=libwinpthread-1.dll` $@
35         cp $(environment_dir)/bin/*.dll $@
36         cp $(environment_dir)/bin/*.exe $@
37         cp $(libgcc_dir)/*.dll $@
38
39
40 # Create a hash from everything in Windows/nsis-bin, but don't
41 # update it unless it has changed
42 Windows/nsis-bin-hashes: Windows/nsis-bin
43         md5sum Windows/nsis-bin/* > $@,tmp
44         @diff -q $@,tmp $@ || mv $@,tmp $@
45
46 # Copy Windows/nsis-bin/* into Windows/nsis-bin-stripped and then strip everything
47 Windows/nsis-bin-stripped: Windows/nsis-bin-hashes
48         @$(MKDIR_P) $@
49         cp Windows/nsis-bin/* $@
50         $(STRIP) $@/*
51
52 # Create a hash from everything in Windows/nsis-bin-stripped, but don't
53 # update it unless it has changed
54 Windows/nsis-bin-stripped-hashes: Windows/nsis-bin-stripped
55         md5sum Windows/nsis-bin-stripped/* > $@,tmp
56         @diff -q $@,tmp $@ || mv $@,tmp $@
57
58
59 Windows/pspp-$(binary_width)bit-debug-install.exe: Windows/pspp.nsi  Windows/nsis-bin-hashes $(nsis_installer_deps)
60         @$(top_builddir)/config.status --config | grep -e --enable-relocatable > /dev/null || \
61         (echo "PSPP must be configured with --enable-relocatable"; false)
62         @$(MKDIR_P) ${@D}
63         makensis -Dpspp_version=$(PACKAGE_VERSION) \
64          -DDEBUG=1 \
65          -DPtrSize=$(binary_width) \
66          -DPrefix=$(DESTDIR)$(prefix) \
67          -DBinDir=$(abs_top_builddir)/Windows/nsis-bin \
68          -DEnvDir=$(environment_dir) \
69          -DSourceDir=$(abs_top_srcdir) \
70          -DOutExe=$(abs_builddir)/$@ $<
71
72 Windows/pspp-$(binary_width)bit-install.exe: Windows/pspp.nsi Windows/nsis-bin-stripped-hashes $(nsis_installer_deps)
73         @$(top_builddir)/config.status --config | grep -e --enable-relocatable > /dev/null || \
74         (echo "PSPP must be configured with --enable-relocatable"; false)
75         @$(MKDIR_P) ${@D}
76         makensis -Dpspp_version=$(PACKAGE_VERSION) \
77          -DDEBUG=0 \
78          -DPtrSize=$(binary_width) \
79          -DPrefix=$(DESTDIR)$(prefix) \
80          -DBinDir=$(abs_top_builddir)/Windows/nsis-bin-stripped \
81          -DEnvDir=$(environment_dir) \
82          -DSourceDir=$(abs_top_srcdir) \
83          -DOutExe=$(abs_builddir)/$@ $<
84
85 Windows/installers: Windows/pspp-$(binary_width)bit-install.exe Windows/pspp-$(binary_width)bit-debug-install.exe