OSDN Git Service

Implement data sheet compiler for list of installed files.
[mingw/mingw-get.git] / Makefile.in
1 # @configure_input@
2 #
3 # $Id$
4
5 PACKAGE_TARNAME = @PACKAGE_TARNAME@
6 PACKAGE_VERSION = @PACKAGE_VERSION@
7
8 # Written by Keith Marshall <keithmarshall@users.sourceforge.net>
9 # Copyright (C) 2009-2013, MinGW.org Project
10 #
11 #
12 # Makefile template for mingw-get
13 #
14 #
15 # This is free software.  Permission is granted to copy, modify and
16 # redistribute this software, under the provisions of the GNU General
17 # Public License, Version 3, (or, at your option, any later version),
18 # as published by the Free Software Foundation; see the file COPYING
19 # for licensing details.
20 #
21 # Note, in particular, that this software is provided "as is", in the
22 # hope that it may prove useful, but WITHOUT WARRANTY OF ANY KIND; not
23 # even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
24 # PARTICULAR PURPOSE.  Under no circumstances will the author, or the
25 # MinGW.org Project, accept liability for any damages, however caused,
26 # arising from the use of this software.
27 #
28 PACKAGE_SUBSYSTEM = @host_os@
29
30 CLI_RELEASE_CLASS = @CLI_RELEASE_CLASS@
31 GUI_RELEASE_CLASS = @GUI_RELEASE_CLASS@
32
33 BUILD_TAG = `>> build.tag; cat build.tag`
34 DEBUGLEVEL = @DEBUGLEVEL@
35
36 srcdir = @srcdir@
37 abs_top_srcdir = @abs_top_srcdir@
38
39 vpath %.ico @srcdir@/icons
40 VPATH = @top_srcdir@/src:@top_srcdir@/src/pkginfo:@top_srcdir@/tinyxml
41
42 CC = @CC@
43 CFLAGS = @CFLAGS@
44 CPPFLAGS = @CPPFLAGS@ -D DEBUGLEVEL=$(DEBUGLEVEL) $(INCLUDES)
45
46 CXX = @CXX@
47 CXXFLAGS = $(CFLAGS)
48
49 INCLUDES = -I ${srcdir}/src -I ${srcdir}/src/pkginfo -I ${srcdir}/tinyxml
50
51 LEX = @LEX@
52
53 AR = @AR@
54 ARFLAGS = @ARFLAGS@
55
56 RC = @RC@
57 RC_SCRIPT = tag=$(BUILD_TAG); \
58   test "x$$tag" != x && tag="-$(GUI_RELEASE_CLASS)-$$tag"; \
59     $(TAG_SCRIPT)
60
61 VERSION_SCRIPT = tag=$(BUILD_TAG); \
62   test "x$$tag" != x && tag="-$(CLI_RELEASE_CLASS)-$$tag"; \
63     $(TAG_SCRIPT)
64
65 TAG_SCRIPT = sed \
66   -e "s!%PACKAGE_NAME%!$(PACKAGE_TARNAME)!g" \
67   -e "s!%PACKAGE_VERSION%!$(PACKAGE_VERSION)$$tag!g" \
68   -e "s!%COPYRIGHT_HOLDER%!@COPYRIGHT_HOLDER@!g" \
69   -e "s!%YEARS_OF_ISSUE%!@YEARS_OF_ISSUE@!g"
70
71 RC_INCLUDES = -I ${srcdir}/src -I ${srcdir}/icons
72
73 OBJEXT = @OBJEXT@
74 EXEEXT = @EXEEXT@
75
76 LDFLAGS = @LDFLAGS@
77 GUI_LDFLAGS = -mwindows $(LDFLAGS)
78 LIBS = -Wl,-Bstatic -llua -lz -lbz2 -llzma -Wl,-Bdynamic -lwininet
79
80 CORE_DLL_OBJECTS  =  climain.$(OBJEXT) pkgshow.$(OBJEXT) dmh.$(OBJEXT) \
81    pkgbind.$(OBJEXT) pkginet.$(OBJEXT) pkgstrm.$(OBJEXT) pkgname.$(OBJEXT) \
82    pkgexec.$(OBJEXT) pkgfind.$(OBJEXT) pkginfo.$(OBJEXT) pkgspec.$(OBJEXT) \
83    pkgopts.$(OBJEXT) sysroot.$(OBJEXT) pkghash.$(OBJEXT) pkgkeys.$(OBJEXT) \
84    pkgdeps.$(OBJEXT) pkgreqs.$(OBJEXT) pkginst.$(OBJEXT) pkgunst.$(OBJEXT) \
85    tarproc.$(OBJEXT) xmlfile.$(OBJEXT) keyword.$(OBJEXT) vercmp.$(OBJEXT) \
86    tinyxml.$(OBJEXT) tinystr.$(OBJEXT) tinyxmlparser.$(OBJEXT) \
87    mkpath.$(OBJEXT)  tinyxmlerror.$(OBJEXT)
88
89 CLI_EXE_OBJECTS  =   \
90    clistub.$(OBJEXT) version.$(OBJEXT) approot.$(OBJEXT) getopt.$(OBJEXT)
91
92 GUIMAIN_OBJECTS  =   \
93    guimain.$(OBJEXT) guidata.$(OBJEXT) guiexec.$(OBJEXT) guidmh.$(OBJEXT) \
94    approot.$(OBJEXT) pkgview.$(OBJEXT) pkgtree.$(OBJEXT) pkglist.$(OBJEXT) \
95    pkgdata.$(OBJEXT) pkgnget.$(OBJEXT)
96
97 GUIMAIN_LIBS = -lwtklite -lcomctl32
98
99 script_srcdir = ${srcdir}/scripts/libexec
100
101 BIN_PROGRAMS = pkginfo$(EXEEXT) mingw-get$(EXEEXT)
102 LIBEXEC_PROGRAMS = guistub$(EXEEXT) guimain$(EXEEXT) lastrites$(EXEEXT)
103 LIBEXEC_SCRIPTS = ${script_srcdir}/setup.lua ${script_srcdir}/wsh.lua \
104    ${script_srcdir}/shlink.js ${script_srcdir}/unlink.js
105 LIBEXEC_DATA = mingw-get-0.dll
106
107 # Primary build goals...
108 #
109 all: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA)
110
111 pkginfo$(EXEEXT):  driver.$(OBJEXT) pkginfo.$(OBJEXT)
112         $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
113
114 mingw-get$(EXEEXT): $(CLI_EXE_OBJECTS)
115         $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $+
116
117 guistub$(EXEEXT): guistub.$(OBJEXT) pkgicon.$(OBJEXT)
118         $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+
119
120 guimain$(EXEEXT): $(GUIMAIN_OBJECTS) $(LIBEXEC_DATA)
121         $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+ $(GUIMAIN_LIBS)
122
123 lastrites$(EXEEXT): rites.$(OBJEXT)
124         $(CC) -o $@ $(CFLAGS) $(GUI_LDFLAGS) $+
125
126 mingw-get-0.dll: $(CORE_DLL_OBJECTS)
127         $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS)
128
129 # Compilation and dependency tracking...
130 #
131 DEPFLAGS = -MM -MP -MD
132 sinclude *.d
133
134 %.$(OBJEXT): %.c
135         $(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
136         $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
137
138 %.$(OBJEXT): %.cpp
139         $(CXX) $(DEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $<
140         $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
141
142 %.$(OBJEXT): %.rc
143         $(CC) $(DEPFLAGS) $(RC_INCLUDES) -DRC_INVOKED -xc-header $<
144         $(RC_SCRIPT) $< | $(RC) $(RC_INCLUDES) -o $@
145
146 %.$(OBJEXT): %.ico
147         echo $* ICON $*.ico | $(RC) -I ${srcdir}/icons -o $@
148
149 # Release tagging...
150 #
151 time-stamp:
152 %.tagged.time: time-stamp
153         > $*.time
154
155 %.time:
156         > $*.time
157
158 %.tag: %.tagged.time
159         >> $@; tag=`date +%Y%m%d`; \
160           tag=`awk -F- -v today=$$tag ' \
161             BEGIN { tag = 1 } $$1 == today { tag += $$2 } \
162             END { print today "-" tag }' $@`; \
163           echo $$tag > $@
164
165 %.c: %.c.in
166         $(VERSION_SCRIPT) $< > $@
167
168 version.c: Makefile build.time
169 guidata.$(OBJEXT): Makefile build.time
170
171 # Installation tools and directory paths...
172 #
173 mkinstalldirs = @MKDIR_P@
174
175 prefix = @prefix@
176 exec_prefix = @exec_prefix@
177 localstatedir = @localstatedir@
178 libexecdir = @libexecdir@
179 bindir = @bindir@
180
181 PACKAGE_CONFIG_DIR = ${localstatedir}/lib/${PACKAGE_TARNAME}/data
182
183 INSTALL = @INSTALL@
184 INSTALL_DATA = @INSTALL_DATA@
185 INSTALL_PROGRAM = @INSTALL_PROGRAM@
186 INSTALL_SCRIPT = @INSTALL_SCRIPT@
187
188 STRIP = @STRIP@
189 LN_S = @LN_S@
190
191 # Installation rules...
192 #
193 installdirs:
194         $(mkinstalldirs) ${bindir}
195         $(mkinstalldirs) ${libexecdir}/${PACKAGE_TARNAME}
196         $(mkinstalldirs) ${PACKAGE_CONFIG_DIR}
197
198 install: installdirs install-profile
199         for image in $(BIN_PROGRAMS); do \
200           $(INSTALL_PROGRAM) $$image ${bindir}; \
201           done
202         for image in $(LIBEXEC_PROGRAMS); do \
203           $(INSTALL_PROGRAM) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
204           done
205         for image in $(LIBEXEC_DATA) $(LIBEXEC_SCRIPTS); do \
206           $(INSTALL_DATA) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
207           done
208
209 install-profile:
210         $(INSTALL_DATA) ${srcdir}/xml/profile.xml \
211           ${PACKAGE_CONFIG_DIR}/defaults.xml
212
213 install-strip: install
214         for image in $(BIN_PROGRAMS); do \
215           $(STRIP) ${bindir}/$$image; \
216           done
217         for image in $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA); do \
218           $(STRIP) ${libexecdir}/${PACKAGE_TARNAME}/$$image; \
219           done
220
221 # Packaging and distribution...
222 # "Native" source files, (i.e. those specific to mingw-get), are...
223 #
224 LICENCE_FILES = README COPYING
225 SRCDIST_FILES = $(LICENCE_FILES) ChangeLog NEWS INSTALL \
226   aclocal.m4 configure.ac configure Makefile.in
227
228 # ...plus the entire content of the sub-directories...
229 #
230 SRCDIST_SUBDIRS = src src/pkginfo srcdist-doc icons \
231   scripts/libexec tinyxml xml
232
233 # In addition to the native sources for mingw-get, our source distribution
234 # must include a filtered subset of those additional files which we import
235 # from the project's global build-aux repository...
236 #
237 BUILD_AUX_DIRS = build-aux build-aux/m4
238 BUILD_AUX_FILES = config.guess config.sub install-sh missing.m4
239
240 # The names of distributed package archive files incorporate version
241 # information, derived from PACKAGE_VERSION; this is decomposed, so that
242 # the PACKAGE_SUBSYSTEM may be interposed between the principal version
243 # number and any qualifying suffix, which specifies development status.
244 # Additionally, the package maintainer may specify, (at `make dist' time),
245 # a SNAPSHOT qualifier; if specified, this will be appended, (literally),
246 # to the principal version number component of the package version number,
247 # as it appears in the distributed archive file names.
248 #
249 PACKAGE_DISTROOT = $(PACKAGE_TARNAME)-$(PACKAGE_ROOTVERSION)
250 PACKAGE_ROOTVERSION = `echo $(PACKAGE_VERSION) | sed 's,-[^0-9].*,,'`
251 PACKAGE_DISTVERSION = `echo $(PACKAGE_VERSION)-$(PACKAGE_SUBSYSTEM) | sed \
252   -e 's,-[^0-9],-$(PACKAGE_SUBSYSTEM)&,' \
253   -e 's,\(-$(PACKAGE_SUBSYSTEM).*\)-$(PACKAGE_SUBSYSTEM),\1,' \
254   -e 's,-$(PACKAGE_SUBSYSTEM),$(SNAPSHOT)&,'`
255 PACKAGE_DISTNAME = $(PACKAGE_TARNAME)-$(PACKAGE_DISTVERSION)
256
257 dist: srcdist bindist readme.txt
258
259 # Specify default compression command, and associated file name extension,
260 # for creation and identification of packaged tar archives.
261 #
262 TARZIP = xz
263 TAREXT = tar.$(TARZIP)
264
265 # The following macros facilitate the inclusion of SCM build tags within
266 # the generated names for the release tarballs; the GCMTAG macro is used
267 # to identify explicitly GUI components, while SCMTAG is used otherwise.
268 #
269 BLDTAG =  @abs_top_builddir@/build.tag
270 SCMTAG = `>> $(BLDTAG); cat $(BLDTAG) | sed 's,.,-$(CLI_RELEASE_CLASS)-&,'`
271 GCMTAG = `>> $(BLDTAG); cat $(BLDTAG) | sed 's,.,-$(GUI_RELEASE_CLASS)-&,'`
272
273 bindist: all licdist
274         rm -rf staged
275         $(MAKE) --no-print-directory prefix=`pwd`/staged install-strip
276         cd staged; tar chf - bin/pkginfo$(EXEEXT) | $(TARZIP) -c > \
277           ../pkginfo-$(PACKAGE_DISTVERSION)$(SCMTAG)-bin.$(TAREXT)
278         rm staged/bin/pkginfo$(EXEEXT)
279         cd staged; tar chf - libexec/mingw-get/guimain$(EXEEXT) | \
280           $(TARZIP) -c > ../$(PACKAGE_DISTNAME)$(GCMTAG)-gui.$(TAREXT)
281         rm staged/libexec/mingw-get/guimain$(EXEEXT)
282         cd staged; tar chf - * | $(TARZIP) -c > \
283           ../$(PACKAGE_DISTNAME)$(SCMTAG)-bin.$(TAREXT)
284         cd staged; zip -r ../$(PACKAGE_DISTNAME)$(SCMTAG)-bin.zip *
285         rm -rf staged
286
287 licdist:
288         rm -rf share
289         $(mkinstalldirs) ./share/doc/${PACKAGE_TARNAME}
290         cd ./share/doc/${PACKAGE_TARNAME}; for file in $(LICENCE_FILES); \
291           do test -f ${abs_top_srcdir}/$$file \
292             && $(LN_S) ${abs_top_srcdir}/$$file . \
293             || $(LN_S) ${CURDIR}/$$file .; \
294           done
295         tar chf - share | $(TARZIP) -c > \
296           $(PACKAGE_DISTNAME)$(SCMTAG)-lic.$(TAREXT)
297         rm -rf share
298
299 srcdist: srcdist-doc
300         rm -rf ${PACKAGE_DISTROOT} && mkdir ${PACKAGE_DISTROOT}
301         cd ${PACKAGE_DISTROOT}; for file in $(SRCDIST_FILES); do \
302           test -f ${abs_top_srcdir}/$$file \
303             && $(LN_S) ${abs_top_srcdir}/$$file . \
304             || $(LN_S) ../$$file .; \
305           done
306         for dir in $(SRCDIST_SUBDIRS); do \
307           $(mkinstalldirs) ${PACKAGE_DISTROOT}/$$dir \
308           && cd ${PACKAGE_DISTROOT}/$$dir; \
309           for file in `cd ${abs_top_srcdir}/$$dir && echo *`; do \
310             if test -f ${abs_top_srcdir}/$$dir/$$file; then \
311               $(LN_S) ${abs_top_srcdir}/$$dir/$$file .; \
312             fi; \
313           done; \
314         cd ${CURDIR}; done
315         for dir in $(BUILD_AUX_DIRS); do \
316           $(mkinstalldirs) ${PACKAGE_DISTROOT}/$$dir \
317           && cd ${PACKAGE_DISTROOT}/$$dir; \
318           for file in $(BUILD_AUX_FILES); do \
319             if test -f ${abs_top_srcdir}/$$dir/$$file; then \
320               $(LN_S) ${abs_top_srcdir}/$$dir/$$file .; \
321             fi; \
322           done; \
323         cd ${CURDIR}; done
324         cd ${PACKAGE_DISTROOT}/src/pkginfo; $(LN_S) ${CURDIR}/pkginfo.c .
325         tar chf - ${PACKAGE_DISTROOT} | $(TARZIP) -c > \
326           $(PACKAGE_DISTNAME)$(SCMTAG)-src.$(TAREXT)
327         rm -rf ${PACKAGE_DISTROOT}
328
329 # README, INSTALL and NEWS files to be included in the source distribution
330 # are generated on demand, as indirect side effects of a set of phoney goals
331 # so that they are always regenerated for each distribution, from templates
332 # in srcdist-doc so that we can make them version specific.
333 #
334 vpath %.in ${srcdir}/srcdist-doc
335 srcdist-doc: README.dist NEWS.dist INSTALL.dist
336
337 # We need to ensure that, when we invoke nroff, the generated output
338 # will be suited to an ASCII class of typesetter; without the -Tascii
339 # option, GNU nroff will substitute Unicode hyphens (u2010) in place
340 # of ASCII hyphens (code 45).
341 #
342 NROFF = nroff -Tascii
343
344 %.dist: %.in gendoc.simple.sed
345         sed -f gendoc.simple.sed $< | $(NROFF) > $*
346
347 %.simple.sed: %.sed.in
348         sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
349             -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", $< > $@
350
351 %.combined.sed: %.sed.in
352         sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
353             -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", \
354             -e s,'^# *cut:',, $< > $@
355
356 # The following rules use sed and awk to match the RCS Id keyword;
357 # we define and use the following macro, in the form "$(DOLLAR)Id:",
358 # to avoid unwanted substitution on CVS checkout.
359 #
360 DOLLAR = $$
361
362 # The following rule provides a mechanism for generating a composite from
363 # README, INSTALL and NEWS, for use as an on-line package description.
364 #
365 readme.txt: gendoc.combined.sed readme.txt.tag readme.txt.in
366         sed s,'$(DOLLAR)Id:.*',"`cat $@.tag`", $@.in > $@
367         echo '$$Document: $@ $$: end of file' >> $@
368         rm -f gendoc.combined.sed $@.*
369
370 # There should be a new generation of readme.txt for each package release;
371 # since each release should also include an updated NEWS file; we adopt the
372 # ID tag-line from NEWS.in, as most the appropriate template for generation
373 # of a corresponding tag-line for readme.in
374 #
375 readme.txt.tag: NEWS.in
376         awk '/\$(DOLLAR)Id:/{ $$2 = "readme.txt\\,v"; print }' $^ > $@
377
378 # The tag-line generated by the preceding rule may then be substituted, by
379 # the primary readme.txt generation rule above, into the document template
380 # generated by the following rule
381 #
382 readme.txt.in: README.in NEWS.in INSTALL.in
383         rm -f $@
384         for input in $^; do \
385           sed -f gendoc.combined.sed $$input | $(NROFF) >> $@; \
386           done
387
388 # Workspace clean-up...
389 #
390 clean:
391         rm -f *.$(OBJEXT) *.d *.dll $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
392
393 distclean: clean
394         rm -f config.* version.c
395
396 maintainer-clean: distclean
397         rm -f README NEWS INSTALL readme.txt Makefile pkginfo.c
398         rm -f *-$(PACKAGE_DISTVERSION)-*.tar.* *-$(PACKAGE_DISTVERSION)-*.zip
399         rm -rf ${PACKAGE_DISTROOT} staged ${srcdir}/autom4te.cache
400
401 # $RCSfile$: end of file