source: tuxpaint-config/trunk/fuentes/Makefile @ 220

Last change on this file since 220 was 220, checked in by mabarracus, 4 years ago

added tuxpaint-config sources from trusty

File size: 11.1 KB
Line 
1# Makefile for tuxpaint-config
2
3# Tux Paint Configuration Tool - A GUI-based configurator for
4#                              Tux Paint, a simple drawing program for children.
5
6# Torsten Giebl <wizard@turricane.org>
7# Jan Wynholds
8# Bill Kendrick <bill@newbreedsoftware.com>
9# Martin Fuhrer <mfuhrer@gmail.com>
10
11# http://www.tuxpaint.org/
12
13# November 12, 2002 - July 6, 2009
14# $Id: Makefile,v 1.39 2009/07/06 16:21:09 wkendrick Exp $
15
16
17VER_VERSION=0.0.13
18VER_DATE=`date +"%Y-%m-%d"`
19
20
21# Where to install things:
22
23PREFIX=/usr/local
24
25
26# Program:
27
28BIN_PREFIX=$(PREFIX)/bin
29EXE_EXT=
30
31
32# Data:
33
34DATA_PREFIX=$(PREFIX)/share/tuxpaint-config/
35
36
37# Docs and man page:
38
39DOC_PREFIX=$(PREFIX)/share/doc/tuxpaint-config/
40MAN_PREFIX=$(PREFIX)/share/man/
41
42
43# Tux Paint's 'System-wide' Config file:
44
45ifeq ($(PREFIX),/usr)
46  CONFDIR=/etc/tuxpaint
47else
48  CONFDIR=$(PREFIX)/etc/tuxpaint
49endif
50
51
52# Icons and launchers:
53
54ICON_PREFIX=$(PREFIX)/share/pixmaps/
55X11_ICON_PREFIX=$(PREFIX)/X11R6/include/X11/pixmaps/
56GNOME_PREFIX=$(shell gnome-config --prefix 2> /dev/null)
57KDE_PREFIX=$(shell kde-config --install apps --expandvars 2> /dev/null)
58KDE_ICON_PREFIX=$(shell kde-config --install icon --expandvars 2> /dev/null)
59
60
61# Locale files
62
63LOCALE_PREFIX=$(PREFIX)/share/locale/
64# LOCALE_PREFIX=/usr/share/locale/
65
66
67# Built with sound by default  (override with "make nosound")
68
69NOSOUNDFLAG=__SOUND
70
71
72# Libraries, paths, and flags:
73
74# FIXME: UTF-8 required for translations; we need to see if we can
75# use fltk-utf8 (and fallback to regular fltk, if not).
76# I did not have luck using fltk-utf8, even in English, though :(
77# -bjk 2008.07.16
78#FLTK_CFLAGS=`fltk-utf8-config --cxxflags`
79#FLTK_LIBS=`fltk-utf8-config --ldflags`
80
81FLTK_CFLAGS=`fltk-config --cxxflags`
82FLTK_LIBS=`fltk-config --ldflags`
83
84PAPER_LIB=-lpaper
85
86# Default CFLAGS:
87CFLAGS=-O2 -Wall
88
89# The entire set of CFLAGS:
90ALL_CFLAGS=$(CFLAGS) $(FLTK_CFLAGS) -DDATA_PREFIX=\"$(DATA_PREFIX)\" \
91        -D$(NOSOUNDFLAG) -DDOC_PREFIX=\"$(DOC_PREFIX)\" \
92        -DLOCALEDIR=\"$(LOCALE_PREFIX)\" -DCONFDIR=\"$(CONFDIR)\" \
93        -DVER_VERSION=\"$(VER_VERSION)\" -DVER_DATE=\"$(VER_DATE)\"
94
95
96# "make" with no arguments builds the program and man page from sources:
97
98all:    tuxpaint-config translations
99        @echo
100        @echo "Done compiling."
101        @echo "Now (probably as 'root' superuser), run 'make install'"
102        @echo "to install Tux Paint Configuration Tool."
103        @echo
104
105releaseclean:
106        @echo
107        @echo "Cleaning release directory"
108        @echo
109        @rm -rf "build/tuxpaint-config-$(VER_VERSION)" "build/tuxpaint-config-$(VER_VERSION).tar.gz"
110        @-if [ -d build ] ; then rmdir build ; fi
111
112releasedir: build/tuxpaint-config-$(VER_VERSION)
113
114build/tuxpaint-config-$(VER_VERSION):
115        @echo
116        @echo "Creating release directory"
117        @echo
118        @mkdir -p build/tuxpaint-config-$(VER_VERSION)
119        @find . -follow \
120                \( -wholename '*/CVS' -o -name .cvsignore -o -name 'build' -o -name '.#*' \) \
121                -prune -o -type f -exec cp --parents -vdp \{\} build/tuxpaint-config-$(VER_VERSION)/ \;
122
123release: releasedir
124        @echo
125        @echo "Creating release tarball"
126        @echo
127        @cd build ; \
128                tar -czvf tuxpaint-config-$(VER_VERSION).tar.gz \
129                tuxpaint-config-$(VER_VERSION)
130
131
132win32:
133        make \
134                EXE_EXT=.exe \
135                ICON_PREFIX=./ \
136                X11_ICON_PREFIX=./ \
137                CONFDIR=$(PREFIX)/etc/tuxpaint \
138                ARCH_LINKS=$(shell if [ "x$$OSTYPE" == "xcygwin" ]; then echo -n "-lintl"; else echo -n "-lintl-8"; fi ) \
139                ARCH_LIBS="obj/resource.o obj/win32utils.o" \
140                PAPER_LIB= 
141
142install-win32:
143        @strip -s tuxpaint-config.exe
144        make install \
145                EXE_EXT=.exe \
146                ICON_PREFIX=./ \
147                X11_ICON_PREFIX=./ \
148                CONFDIR=$(PREFIX)/etc/tuxpaint \
149                ARCH_LINKS=$(shell if [ "x$$OSTYPE" == "xcygwin" ]; then echo -n "-lintl"; else echo -n "-lintl-8"; fi ) \
150                ARCH_LIBS="obj/resource.o obj/win32utils.o"
151
152# "make install" installs all of the various parts
153# (depending on the *PREFIX variables at the top, you probably need
154# to do this as superuser ("root"))
155
156install:        install-bin install-data install-man install-doc \
157                install-gnome install-kde install-kde-icons \
158                install-icon install-gettext
159        @echo
160        @echo "All done! Now (preferably NOT as 'root' superuser),"
161        @echo "you can type the command 'tuxpaint-config' to run the"
162        @echo "configuration tool!"
163        @echo
164        @echo "Enjoy!"
165        @echo
166
167
168# "make clean" deletes the program, the compiled objects and the
169# built man page (returns to factory archive, pretty much...)
170
171clean:
172        @echo "Cleaning up the build directory ($(PWD))"
173        @-rm -f tuxpaint-config tuxpaint-config.exe
174        @-rm -f obj/*.o
175        @#if [ -d obj ]; then rmdir obj; fi
176        @-rm -f trans/*.mo
177        @if [ -d trans ]; then rmdir trans; fi
178
179
180# "make uninstall" should remove the various parts from their
181# installation locations.  BE SURE the *PREFIX variables at the top
182# are the same as they were when you installed, of course!!!
183
184uninstall:
185        -if [ "x$(GNOME_PREFIX)" != "x" ]; then \
186          rm $(GNOME_PREFIX)/share/applications/tuxpaint-config.desktop; \
187          rm $(GNOME_PREFIX)/share/pixmaps/tuxpaint-config.png; \
188        fi
189        -if [ "x$(KDE_PREFIX)" != "x" ]; then \
190          rm $(KDE_PREFIX)/Preferences/tuxpaint-config.desktop; \
191        fi
192        -rm $(ICON_PREFIX)tuxpaint-config.png
193        -rm $(X11_ICON_PREFIX)tuxpaint-config.xpm
194        -rm $(BIN_PREFIX)/tuxpaint-config
195        -rm -r $(DATA_PREFIX)
196        -rm -r $(DOC_PREFIX)
197        -rm $(MAN_PREFIX)/man1/tuxpaint-config.1.gz
198
199
200# Install a launcher icon in the Gnome menu, under "Graphhics"
201
202install-gnome:
203        @echo
204        @echo "...Installing launcher icon into GNOME..."
205        @if [ "x$(GNOME_PREFIX)" != "x" ]; then \
206          install -d $(GNOME_PREFIX)/share/pixmaps; \
207          cp data/images/icon.png $(GNOME_PREFIX)/share/pixmaps/tuxpaint-config.png; \
208          chmod 644 $(GNOME_PREFIX)/share/pixmaps/tuxpaint-config.png; \
209          install -d $(GNOME_PREFIX)/share/applications; \
210          cp src/tuxpaint-config.desktop $(GNOME_PREFIX)/share/applications/; \
211          chmod 644 $(GNOME_PREFIX)/share/applications/tuxpaint-config.desktop; \
212        fi
213
214
215# Install a launcher icon in the KDE menu...
216
217install-kde:
218        @echo
219        @echo "...Installing launcher icon into KDE..."
220        @if [ "x$(KDE_PREFIX)" != "x" ]; then \
221          install -d $(KDE_PREFIX)/Preferences/; \
222          cp src/tuxpaint-config.desktop $(KDE_PREFIX)/Preferences/; \
223          chmod 644 $(KDE_PREFIX)/Preferences/tuxpaint-config.desktop; \
224        fi
225
226
227install-kde-icons:
228        @echo "...Installing launcher icon graphics into KDE..."
229        @if [ "x$(KDE_ICON_PREFIX)" != "x" ]; then \
230          cp data/images/icon48x48.png \
231                $(KDE_ICON_PREFIX)/hicolor/48x48/apps/tuxpaint-config.png; \
232          cp data/images/icon32x32.png \
233                $(KDE_ICON_PREFIX)/hicolor/32x32/apps/tuxpaint-config.png; \
234          cp data/images/icon16x16.png \
235                $(KDE_ICON_PREFIX)/hicolor/16x16/apps/tuxpaint-config.png; \
236        fi
237
238
239# Install the PNG icon (for GNOME, KDE, etc.)
240# and the 24-color 32x32 XPM (for other Window managers):
241
242install-icon:
243        @echo
244        @echo "...Installing launcher icon graphics..."
245        @install -d $(ICON_PREFIX)
246        @cp data/images/icon.png $(ICON_PREFIX)tuxpaint-config.png
247        @chmod 644 $(ICON_PREFIX)tuxpaint-config.png
248        @install -d $(X11_ICON_PREFIX)
249        @cp data/images/icon32x32.xpm $(X11_ICON_PREFIX)tuxpaint-config.xpm
250        @chmod 644 $(X11_ICON_PREFIX)tuxpaint-config.xpm
251
252
253# Install the program:
254
255install-bin:
256        @echo
257        @echo "...Installing program itself..."
258        @cp tuxpaint-config $(BIN_PREFIX)
259        @chmod a+rx,g-w,o-w $(BIN_PREFIX)/tuxpaint-config$(EXE_EXT)
260
261
262# Install the data (sound, graphics, fonts):
263
264install-data:
265        @echo
266        @echo "...Installing data files..."
267        @install -d $(DATA_PREFIX)
268        @cp -R data/* $(DATA_PREFIX)
269        @chmod -R a+rX,g-w,o-w $(DATA_PREFIX)
270
271
272# Install the text documentation:
273
274install-doc:
275        @echo
276        @echo "...Installing documentation..."
277        @echo "(English)"
278        @install -d $(DOC_PREFIX)
279        @install -d $(DOC_PREFIX)/html
280        @cp docs/AUTHORS.txt $(DOC_PREFIX)
281        @cp docs/CHANGES.txt $(DOC_PREFIX)
282        @cp docs/COPYING.txt $(DOC_PREFIX)
283        @cp docs/README.txt $(DOC_PREFIX)
284        @cp docs/html/README.html $(DOC_PREFIX)/html
285        @cp docs/TODO.txt $(DOC_PREFIX)
286        @echo "(...Setting permissions)"
287        @chmod -R a+rx,g-w,o-w $(DOC_PREFIX)
288
289
290# Install the man page:
291
292install-man:
293        @echo "...Installing man pages..."
294        # man1 directory...
295        @install -d $(MAN_PREFIX)/man1/
296        # tuxpaint-config.1
297        @cp src/tuxpaint-config.1 $(MAN_PREFIX)/man1/
298        @gzip -9f $(MAN_PREFIX)/man1/tuxpaint-config.1
299        @chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tuxpaint-config.1.gz
300
301
302# Build the program!
303
304tuxpaint-config:        obj/tuxpaint-config.o obj/tuxpaint-config2.o    \
305                        obj/defaults.o $(ARCH_LIBS)
306        @echo Linking
307        $(CXX) $(ALL_CFLAGS) -o tuxpaint-config obj/tuxpaint-config.o   \
308                        obj/tuxpaint-config2.o obj/defaults.o $(ARCH_LIBS) \
309                        $(FLTK_LIBS) $(ARCH_LINKS) $(PAPER_LIB)
310
311
312# Build the object for the program!
313
314obj/tuxpaint-config.o:  src/tuxpaint-config.cxx src/version.h src/about.h
315        @echo Compiling tuxpaint-config.cxx
316        $(CXX) $(ALL_CFLAGS) -c src/tuxpaint-config.cxx -o obj/tuxpaint-config.o
317
318obj/tuxpaint-config2.o: src/tuxpaint-config2.cxx src/version.h src/about.h
319        @echo Compiling tuxpaint-config2.cxx
320        $(CXX) $(ALL_CFLAGS) -c src/tuxpaint-config2.cxx -o obj/tuxpaint-config2.o
321
322obj/defaults.o: src/defaults.cxx
323        @echo Compiling defaults.cxx
324        $(CXX) $(ALL_CFLAGS) -c src/defaults.cxx -o obj/defaults.o
325
326obj/win32utils.o: src/win32utils.cxx src/win32utils.h
327        @echo Compiling win32utils.cxx
328        $(CXX) $(ALL_CFLAGS) -c src/win32utils.cxx -o obj/win32utils.o
329
330obj/resource.o: visualc/resource.rc visualc/resource.h
331        @echo
332        @echo "...Compiling win32 resources..."
333        @windres -i visualc/resource.rc -o obj/resource.o
334
335
336# Translation stuff:
337
338POFILES:=$(wildcard src/po/*.po)
339MOFILES:=$(patsubst src/po/%.po,trans/%.mo,$(POFILES))
340INSTALLED_MOFILES:=$(patsubst trans/%.mo,$(LOCALE_PREFIX)/%/LC_MESSAGES/tuxpaint-config.mo,$(MOFILES))
341
342$(INSTALLED_MOFILES): $(LOCALE_PREFIX)/%/LC_MESSAGES/tuxpaint-config.mo: trans/%.mo
343        install -D -m 644 $< $@
344
345.PHONY: uninstall-i18n
346uninstall-i18n:
347        -rm $(LOCALE_PREFIX)/*/LC_MESSAGES/tuxpaint-config.mo
348
349
350# Install the translated text:
351# We can install *.mo files if they were already generated, or if it can be
352# generated from the *.po files.  The *.mo files can be generated from the
353# *.po files if we have the converter program, msgfmt, installed in the
354# system.  So we test for both and install them if either case is found
355# to be true.  If neither case is found to be true, we'll just install
356# Tux Paint without the translation files.
357.PHONY: install-gettext
358ifeq "$(wildcard trans/*.mo)$(shell msgfmt -h)" ""
359install-gettext:
360        @echo
361        @echo "--------------------------------------------------------------"
362        @echo "Cannot install translation files because no translation files"
363        @echo "were found (trans/*.mo) and the 'msgfmt' program is not installed."
364        @echo "You will not be able to run Tux Paint in non-U.S. English modes."
365        @echo "--------------------------------------------------------------"
366else
367install-gettext: $(INSTALLED_MOFILES)
368endif
369
370
371# Build the translation files for gettext
372
373$(MOFILES): trans/%.mo: src/po/%.po
374        msgfmt -o $@ $<
375
376.PHONY: translations
377ifeq "$(shell msgfmt -h)" ""
378translations: trans
379        @echo "--------------------------------------------------------------"
380        @echo "Cannot find program 'msgfmt'!"
381        @echo "No translation files will be prepared."
382        @echo "Install gettext to run Tux Paint in non-U.S. English modes."
383        @echo "--------------------------------------------------------------"
384else
385translations: trans $(MOFILES)
386endif
387
388trans:
389        @echo
390        @echo "...Preparing translation files..."
391        @mkdir trans
392
393
394# Make the "obj" directory to throw the object(s) into:
395
396obj:
397        @mkdir obj
398
Note: See TracBrowser for help on using the repository browser.