1## Top-level Makefile.am for tuxmath:
2## Process with Automake to create Makefile.in
3
4
5## ---------------------------------------------------------------------------
6## Variables: ----------------------------------------------------------------
7## ---------------------------------------------------------------------------
8
9
10SUBDIRS = data	\
11	doc	\
12	po	\
13	src
14
15ACLOCAL_AMFLAGS = -I m4
16
17EXTRA_DIST = t4k_common.mk \
18	tuxmath.spec \
19	tuxmath.desktop \
20	config.rpath \
21	m4/ChangeLog \
22	Info.plist \
23	CMakeLists.txt \
24        cmake-modules/ConfigureChecks.cmake \
25        cmake-modules/ConfigureChecksIntl.cmake \
26        cmake-modules/FindIconv.cmake \
27        cmake-modules/FindMSGFMT.cmake \
28        cmake-modules/FindSDL_gfx.cmake \
29        cmake-modules/FindSDL_Pango.cmake \
30        cmake-modules/FindTux4Kids-common.cmake \
31        cmake-modules/T4K_Sugar.cmake \
32        po/CMakeLists.txt \
33	config.h.cmake \
34	buildw32/cross-configure.sh \
35	buildw32/cross-make.sh \
36	buildw32/setup_mingw-cross-env.sh \
37	buildw32/tmwin.sh \
38	buildw32/t4k_common.mk
39
40##datadir = @datadir@
41##localedir = $(datadir)/locale
42
43
44## These are defined in configure.ac:
45##MAKENSIS=$(NSIS)
46##NSIS_FOUND=@NSIS_FOUND@
47##NSI_INSTALL_DIR=@NSI_INSTALL_DIR@
48##NSI_DLL_DIR=@NSI_DLL_DIR@
49NSI_TEMP_INSTALL_DIR=$(abs_top_builddir)/_instw32
50
51## ---------------------------------------------------------------------------
52## Rules: --------------------------------------------------------------------
53## ---------------------------------------------------------------------------
54
55
56## Bundle in fonts for distribution tar.gz to be used without package manager:
57## i.e. to make tarball to post for individual download.
58##
59## for tarball with fonts: use 'make dist_with_fonts' (for *tar.gz)
60## or 'make dist_with_fonts_bzip2 (for *tar.bzip2)
61## for tarball without fonts: (e.g. for Debian packaging) - use 'make distcheck'
62##
63## (thanks to Ralf Wildenhues <Ralf.Wildenhues@gmx.de> for automake help!)
64## 'dist_fonts' is in EXTRA_DATA but is empty by default.  With this target,
65## 'dist_fonts' gets set to a list of the font files in data/fonts before making
66## 'dist', causing the fonts to be included in the tar.gz.
67## 'data_fonts' should contain all of the fonts in data/fonts. It needs to go
68## in this Makefile.am before the 'dist_with_fonts' target for that target
69## to work - if it is in data/fonts/Makefile.am, it does not get expanded
70## before the 'dist' target starts:
71data_fonts='AndikaDesRevG.ttf'
72dist_with_fonts:
73	$(MAKE) $(AM_MAKEFLAGS) distdir=$(PACKAGE)_w_fonts-$(VERSION) \
74           dist_fonts=$(data_fonts) dist
75dist_with_fonts_bzip2:
76	$(MAKE) $(AM_MAKEFLAGS) distdir=$(PACKAGE)_w_fonts-$(VERSION) \
77           dist_fonts=$(data_fonts) dist-bzip2
78
79
80
81
82## For building the NSIS executable Win32 installer - this rule first
83## does a "make install" into NSI_TEMP_INSTALL_DIR, which results in
84## a local copy of the complete unix-style install.
85## Subsequent commands then copy the needed files into NSI_INSTALL_DIR,
86## which has the exact directory structure of the self-contained
87## 'TuxMath' folder that gets installed onto the Windows machine.
88
89install-nsi-local: all
90## create NSI_TEMP_INSTALL_DIR and install to that location:
91	$(INSTALL) -d $(NSI_TEMP_INSTALL_DIR)
92	$(MAKE) $(AM_MAKEFLAGS) DESTDIR=$(NSI_TEMP_INSTALL_DIR) install
93## create NSI_INSTALL_DIR/data dir and copy data files to that location:
94	$(INSTALL) -d $(top_builddir)/$(NSI_INSTALL_DIR)/data;
95	(cd $(NSI_TEMP_INSTALL_DIR)/$(pkgdatadir); \
96           tar cf -  * ) \
97           | ( cd $(top_builddir)/$(NSI_INSTALL_DIR)/data; \
98           tar xf -)
99## create NSI_INSTALL_DIR/doc dir and copy docs to that location:
100	$(INSTALL) -d $(top_builddir)/$(NSI_INSTALL_DIR)/doc;
101	(cd $(NSI_TEMP_INSTALL_DIR)/$(docdir); \
102           tar cf -  * ) \
103           | ( cd $(top_builddir)/$(NSI_INSTALL_DIR)/doc; \
104           tar xf -)
105## create NSI_INSTALL_DIR/locale dir and copy locales to that location:
106	$(INSTALL) -d $(top_builddir)/$(NSI_INSTALL_DIR)/locale;
107	(cd $(NSI_TEMP_INSTALL_DIR)/$(localedir); \
108           tar cf -  * ) \
109           | ( cd $(top_builddir)/$(NSI_INSTALL_DIR)/locale; \
110           tar xf -)
111## copy executable into NSI_INSTALL_DIR:
112	(cd $(NSI_TEMP_INSTALL_DIR)/$(bindir); \
113           mv *TuxMath.exe TuxMath.exe; \
114           tar cf - TuxMath.exe  ) \
115           | ( cd $(top_builddir)/$(NSI_INSTALL_DIR); \
116           tar xf -)
117## Done with NSI_TEMP_INSTALL_DIR so uninstall:
118	$(MAKE) $(AM_MAKEFLAGS) DESTDIR=$(NSI_TEMP_INSTALL_DIR) uninstall
119	rm -rf $(NSI_TEMP_INSTALL_DIR)
120## Convert text files from Unix format DOS/Windows format and rename
121## them with ".txt" extension:
122	(cd $(top_builddir)/$(NSI_INSTALL_DIR)/doc; \
123	FILES=`find . -type f`; \
124	for file in $$FILES; do \
125	    echo "Processing "$$file; \
126	    $(U2D) $$file; \
127	    mv $$file $$file".txt"; \
128	done)
129
130	(cd $(top_builddir)/$(NSI_INSTALL_DIR)/data/missions; \
131	FILES=`find . -type f`; \
132	for file in $$FILES; do \
133	    echo "Processing "$$file; \
134	    $(U2D) $$file; \
135	    mv $$file $$file".txt"; \
136	done)
137
138## NOTE: we don't use any dll files now that we use mingw-cross-env
139## because the entire executable is statically linked.
140## copy needed dll files into NSI_INSTALL_DIR:
141#	-cp $(NSI_DLL_DIR)/*.dll $(top_builddir)/$(NSI_INSTALL_DIR);
142
143## NOTE: However, we do need to copy non-executable data and config files
144## needed by the libraries that we have used:
145
146## Copy data files for our t4k_common library:
147	(cd $(prefix)/share/t4k_common; \
148	   tar cf - * ) \
149           | ( cd $(top_builddir)/$(NSI_INSTALL_DIR)/data; \
150           tar xf -)
151	echo 'fontconfig files: ' $(sysconfdir)/fonts
152
153## Create NSI_INSTALL_DIR/fonts dir and copy fontconfig's needed
154## fonts dir to that location.
155
156## NOTE: $(sysconfdir) will point to the etc dir
157## in the mingw-cross-env installation, where the fontconfig lib will have
158## installed a dir called "fonts" containing the libs config files, most
159## importantly fonts.conf.  This folder must be copied into the same dir on
160## the user's Windows machine as the final TuxMath.exe binary.  It would be
161## desirable to be able to set this to a location of our choice - DSB.
162	$(INSTALL) -d $(top_builddir)/$(NSI_INSTALL_DIR)/fonts;
163	(cd $(sysconfdir)/fonts; \
164           tar cf -  * ) \
165           | ( cd $(top_builddir)/$(NSI_INSTALL_DIR)/fonts; \
166           tar xf -)
167
168
169install-nsi-am: install-nsi-local
170
171
172nsis:
173
174	if test "x$(U2D)" = "x"; then \
175	  echo "\nWarning - unix2dos (or todos) program not found!"; \
176          echo "It is needed to convert text files to Windows format."; \
177          echo "Without this program, user documention will be in Unix" ; \
178          echo "format, which will not display correctly with common"; \
179          echo "Windows text editors such as Notepad\n"; \
180	fi
181
182	if test "x$(NSIS)" = "x"; then \
183	  echo "\nError - makensis program not found!"; \
184          echo "It is needed to build the NSIS executable installer for Windows."; \
185          echo "Install it from your distribution's repository, or" ; \
186          echo "download it from: http://nsis.sourceforge.net/Download\n"; \
187	else \
188	$(MAKE) $(AM_MAKEFLAGS) install-nsi-local; \
189	  $(NSIS) -NOCD nsis/tuxmath.nsi; \
190	fi
191
192
193clean-local:
194	@$(NORMAL_CLEAN)
195	if test -d $(NSI_INSTALL_DIR); then \
196	  rm -fr $(NSI_INSTALL_DIR); \
197	fi
198	if test -e tuxmath-@VERSION@-win32-installer.exe; then \
199	  rm tuxmath-@VERSION@-win32-installer.exe; \
200	fi
201
202.PHONY: nsis
203
204