Minor tweaks to jigdo-lite for the windows 0.8.0a release
[jigdo.git] / Makefile.in
1 # Project: Jigdo (Jigsaw download)
2 #  __   _
3 #  |_) /|  Copyright (C) 2001-2006  |  richard@
4 #  | \/¯|  Richard Atterer          |  atterer.org
5 #  ¯ '` ¯
6 # this Makefile mostly forwards make commands to the other directories
7 srcdir =        @srcdir@
8 VPATH =         @srcdir@
9
10 prefix =        @prefix@
11 exec_prefix =   @exec_prefix@
12 bindir =        @bindir@
13 mandir =        @mandir@
14 datadir =       @datadir@
15
16 PACKAGE =       jigdo
17 INSTALL =       @INSTALL@
18 INSTALL_EXE =   @INSTALL@ #-s
19 INSTALL_DATA =  @INSTALL@ -m 644
20 INSTALL_SCRIPT = @INSTALL@ -m 755
21 AWK =           @AWK@
22
23 # echo `(echo progress051.xpm;sed -n 's/^.*>\(.*\.xpm\)<.*$/\1/p' jigdo.glade)|sort|uniq`
24 icons =         close.png jigdo-logo.png pause.png progress-green.png \
25                 restart.png start.png stop.png
26 catalogs =      @CATALOGS@
27
28 .PHONY:         all all_msg clean distclean mostlyclean maintainer-clean \
29                 dep depend doc cvsdist check install test loc deb debrpm \
30                 install-jigdo-file install-jigdo-lite install-jigdo \
31                 install-po
32 # "gfx" symlink is needed for the pixmaps to be found by jigdo
33 all doc mostlyclean dep depend: Makefile
34                 -test -h gfx -o -d gfx || ln -s "$(srcdir)/gfx" gfx
35                 cd src && $(MAKE) $@ EXTRA_CFLAGS="$(EXTRA_CFLAGS)" EXTRA_CXXFLAGS="$(EXTRA_CXXFLAGS)" EXTRA_LDFLAGS="$(EXTRA_LDFLAGS)"
36                 cd doc && $(MAKE) $@
37                 cd po  && $(MAKE) $@
38 check test: Makefile
39                 -test -h gfx -o -d gfx || ln -s "$(srcdir)/gfx" gfx
40                 cd src && $(MAKE) $@
41 clean:          Makefile
42                 cd src && $(MAKE) $@
43                 cd doc && $(MAKE) $@
44                 cd po  && $(MAKE) $@
45                 rm -f mirrors.jigdo mirrors.list mirrors.txt
46 distclean:      Makefile
47                 cd src && $(MAKE) $@
48                 cd doc && $(MAKE) $@
49                 cd po  && $(MAKE) $@
50                 rm -f mirrors.jigdo mirrors.list mirrors.txt
51                 rm -f jigdo-*.tar.gz jigdo-*.tar.bz2
52                 rm -f *~ \#*\# *.bak
53                 rm -f Makefile config.h config.cache config.log config.status
54                 rm -f deb/*~ deb/\#*\# deb/*.bak deb/changelog
55                 rm -f scripts/*~ scripts/\#*\# scripts/*.bak
56 #               -rm -f debian
57 maintainer-clean: Makefile
58                 @echo 'This command is intended for maintainers to use; it'
59                 @echo 'deletes files that may need special tools to rebuild.'
60                 cd src && $(MAKE) $@
61                 cd doc && $(MAKE) $@
62                 cd po  && $(MAKE) $@
63                 rm -f mirrors.jigdo mirrors.list mirrors.txt
64                 rm -f jigdo-*.tar.gz jigdo-*.tar.bz2
65                 rm -f *~ \#*\# *.bak
66                 rm -f Makefile config.h config.cache config.log config.status
67                 rm -f configure
68                 cd $(srcdir) && autoconf
69
70 install:        install-po install-jigdo-file install-jigdo-lite \
71                 install-jigdo-mirror @IF_GUI@ install-jigdo
72 install-jigdo-file:
73                 $(INSTALL) -d $(DESTDIR)$(bindir)
74                 $(INSTALL_EXE) src/jigdo-file $(DESTDIR)$(bindir)
75                 $(INSTALL) -d $(DESTDIR)$(mandir)/man1
76                 x="doc/jigdo-file.1"; \
77                 test -f "$$x" || x="$(srcdir)/$$x"; \
78                 $(INSTALL) "$$x" $(DESTDIR)$(mandir)/man1
79 install-jigdo-lite:
80                 $(INSTALL) -d "$(DESTDIR)$(bindir)"
81                 $(INSTALL) -d "$(DESTDIR)$(datadir)/jigdo"
82                 $(INSTALL_SCRIPT) "$(srcdir)/scripts/jigdo-lite" \
83                     "$(DESTDIR)$(bindir)"
84                 sed -e 's%"\(mirrors.jigdo"\)%"$(datadir)/jigdo/debian-\1%' \
85                     <"$(srcdir)/scripts/jigdo-lite" \
86                     >"$(DESTDIR)$(bindir)/jigdo-lite"
87                 $(INSTALL_DATA) "$(srcdir)/scripts/debian-mirrors.jigdo" \
88                     "$(DESTDIR)$(datadir)/jigdo"
89                 $(INSTALL) -d $(DESTDIR)$(mandir)/man1
90                 x="doc/jigdo-lite.1"; \
91                 test -f "$$x" || x="$(srcdir)/$$x"; \
92                 $(INSTALL) "$$x" $(DESTDIR)$(mandir)/man1
93 install-jigdo-mirror:
94                 $(INSTALL) -d "$(DESTDIR)$(bindir)"
95                 $(INSTALL_SCRIPT) "$(srcdir)/scripts/jigdo-mirror" \
96                     "$(DESTDIR)$(bindir)"
97                 $(INSTALL) -d $(DESTDIR)$(mandir)/man1
98                 x="doc/jigdo-mirror.1"; \
99                 test -f "$$x" || x="$(srcdir)/$$x"; \
100                 $(INSTALL) "$$x" $(DESTDIR)$(mandir)/man1
101 install-jigdo:
102                 $(INSTALL) -d "$(DESTDIR)$(bindir)"
103                 $(INSTALL_EXE) src/jigdo "$(DESTDIR)$(bindir)"
104                 $(INSTALL) -d "$(DESTDIR)$(datadir)/jigdo/pixmaps"
105                 @for x in $(icons); do \
106                     echo "$(INSTALL_DATA) \"$(srcdir)/gfx/$$x\"" \
107                         "\"$(DESTDIR)$(datadir)/jigdo/pixmaps\""; \
108                     $(INSTALL_DATA) "$(srcdir)/gfx/$$x" \
109                         "$(DESTDIR)$(datadir)/jigdo/pixmaps" || exit 1; \
110                 done
111                 $(INSTALL) -d $(DESTDIR)$(mandir)/man1
112                 x="doc/jigdo.1"; \
113                 test -f "$$x" || x="$(srcdir)/$$x"; \
114                 $(INSTALL) "$$x" $(DESTDIR)$(mandir)/man1
115                 $(INSTALL_DATA) "$(srcdir)/COPYING" \
116                     "$(DESTDIR)$(datadir)/jigdo/COPYING"
117 install-po:
118                 if test -n "$(catalogs)"; then for file in $(catalogs); do \
119                     lang=`echo $$file | sed -e 's/\.gmo$$//'`; \
120                     dir="$(DESTDIR)$(datadir)/locale/$$lang/LC_MESSAGES"; \
121                     echo "$(INSTALL) -d \"$$dir\""; \
122                     $(INSTALL) -d "$$dir"; \
123                     s="$(srcdir)/po/$$file"; \
124                     if test -f "po/$$file"; then s="po/$$file"; fi; \
125                     echo "$(INSTALL_DATA) $$s \"$$dir/$(PACKAGE).mo\""; \
126                     $(INSTALL_DATA) "$$s" "$$dir/$(PACKAGE).mo" \
127                         || exit 1; \
128                 done; fi
129
130 Makefile:       Makefile.in configure jigdo.spec
131                 sh config.status # update Makefile from Makefile.in
132
133 configure:      configure.ac
134                 cd "$(srcdir)" && autoconf
135                 rm -f config.cache
136
137 # allow "make CXXFLAGS=-O0" while staying compatible with non-GNU-make
138 .EXPORT_ALL_VARIABLES: ;
139 #______________________________________________________________________
140
141 # Nonstandard targets
142
143 # Vanity meter :-)
144 loc:
145                 f=`find $(srcdir)/src \( -name '*.cc' -o -name '*.[hif]h' \) -a ! -name interface.cc` \
146                     && printf '%d files, %d lines of code\n' \
147                        `echo $$f|wc -w` `cat $$f|wc -l`
148
149 # Compile and package unofficial Debian package
150 deb:
151                 @if test "`pwd`" != "`cd '$(srcdir)' && pwd`"; then \
152                  echo "   * Building .deb package only possible if you are";\
153                  echo "   * building in the source dir, i.e. invoked the"; \
154                  echo "   * configure script as \`./configure'"; \
155                  exit 1; fi
156                 test -e debian || ln -s deb debian
157                 dpkg-buildpackage -rfakeroot -us -uc -b
158
159 # Convert Debian package into RPM format
160 debrpm:         deb
161                 for deb in ../jigdo*.deb; do \
162                     fakeroot alien -r "$$deb"; \
163                 done
164
165 # Compile and create a tar.bz2 containing the tools and documentation
166 bindist:        Makefile
167                 @read tmpa tmpb VERSION <"$(srcdir)/jigdo.spec"; \
168                 if test -d "jigdo-bin-$$VERSION"; then \
169                  echo "\`jigdo-bin-$$VERSION' exists - delete it first";\
170                  exit 1; \
171                 fi
172                 rm -f src/jigdo-file
173                 cd src && $(MAKE) Y='-static' all-msg jigdo-file strip
174                 cd doc && $(MAKE) all
175                 jdir=jigdo-bin-`read a b v <"$(srcdir)/jigdo.spec" && echo $$v`; \
176                     mkdir "$$jdir"; \
177                     $(INSTALL_SCRIPT) $(srcdir)/scripts/jigdo-lite "$$jdir";\
178                     $(INSTALL_SCRIPT) $(srcdir)/scripts/jigdo-mirror \
179                         "$$jdir"; \
180                     $(INSTALL_EXE) src/jigdo-file "$$jdir"; \
181                     grep -v "^##" $(srcdir)/doc/README-bindist.txt \
182                         >"$$jdir/README"; \
183                     $(INSTALL_DATA) $(srcdir)/doc/*.html "$$jdir"; \
184                     $(INSTALL_DATA) $(srcdir)/doc/*.1    "$$jdir"; \
185                     $(INSTALL_DATA) $(srcdir)/COPYING    "$$jdir"; \
186                     $(INSTALL_DATA) $(srcdir)/scripts/debian-mirrors.jigdo \
187                         "$$jdir/mirrors.jigdo"; \
188                     tar -cf "$$jdir.tar" "$$jdir"; \
189                     bzip2 -f -9 "$$jdir.tar"; \
190                     rm -rf "$$jdir" src/jigdo-file
191
192 # Compile and create a zip file containing the tools and documentation for Windows
193 # Assumes that things are already set up and configured for the Windows build
194 windist:        Makefile all
195                 @VERSION=$$(git describe | awk '{gsub("^.*/","");print $$0}'); \
196                 WD=$$(pwd); \
197                 if test -d "../jigdo-win-$$VERSION"; then \
198                  echo "\`../jigdo-win-$$VERSION' exists - delete it first";\
199                  exit 1; \
200                 fi ; \
201                 jdir=jigdo-win-$$VERSION; \
202                     mkdir "../$$jdir"; \
203                     mkdir "../$$jdir/jigdo-bin"; \
204                     $(INSTALL_SCRIPT) $(srcdir)/scripts/jigdo-lite "../$$jdir/jigdo-bin";\
205                     $(INSTALL_SCRIPT) $(srcdir)/scripts/jigdo-mirror \
206                         "../$$jdir/jigdo-bin"; \
207                     $(INSTALL_EXE) src/jigdo-file.exe "../$$jdir/jigdo-bin"; \
208                     grep -v "^##" $(srcdir)/doc/README-windist.txt \
209                         | todos  >"../$$jdir/README.txt"; \
210                     $(INSTALL_DATA) $(srcdir)/doc/*.html "../$$jdir"; \
211                     $(INSTALL_DATA) $(srcdir)/scripts/debian-mirrors.jigdo \
212                         "../$$jdir/jigdo-bin/mirrors.jigdo"; \
213                     $(INSTALL_EXE) $(srcdir)/win-binaries/* "../$$jdir/jigdo-bin"; \
214                     cat $(srcdir)/scripts/jigdo-lite.bat | todos > "../$$jdir/jigdo-lite.bat"; \
215                     cd .. && zip -9 -v -r "$$jdir.zip" "$$jdir" && rm -rf "$$jdir" && cd $$WD
216
217 debian-mirrors.jigdo: Mirrors.masterlist
218                 $(AWK) -f $(srcdir)/scripts/convert-cvsmirrors.awk "$<" >"$@"
219
220 # Create source tarball from git. Complicated some - do autoconf dance
221 # in there too
222 gitdist:        Makefile
223                 @VERSION=$$(git describe | awk '{gsub("^.*/","");print $$0}'); \
224                 echo "VERSION is $$VERSION"; \
225                 OUTPUT="jigdo-$$VERSION"; \
226                 WD=$$(pwd); \
227                 if [ -e "../$$OUTPUT.tar.xz" ]; then \
228                  echo "../$$OUTPUT.tar.xz exists - delete it first"; \
229                  exit 1; \
230                 fi ; \
231                 if [ -d "../$$OUTPUT" ]; then \
232                  echo "../$$OUTPUT exists - delete it first"; \
233                  exit 1; \
234                 fi ; \
235                 echo "Creating working dir in ../$$OUTPUT"; \
236                 git archive --format=tar --prefix="$$OUTPUT/" HEAD | tar -C .. -xf - ; \
237                 echo "Running autoconf then cleanup in ../$$OUTPUT"; \
238                 cd ../$$OUTPUT/ && autoconf && rm -rf autom4te.cache && cd $$WD; \
239                 echo "Creating dist tarball in ../$$OUTPUT.tar.xz"; \
240                 tar -C .. -c --xz -f ../$$OUTPUT.tar.xz $$OUTPUT; rm -rf ../$$OUTPUT
241