OSDN Git Service

Add scripting hooks to support creation of MS-Windows shortcuts.
[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, 2010, 2011, 2012, MinGW 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 Project, accept liability for any damages, however caused,
26 # arising from the use of this software.
27 #
28 PACKAGE_SUBSYSTEM = @host_os@
29
30 srcdir = @srcdir@
31 abs_top_srcdir = @abs_top_srcdir@
32
33 DEBUGLEVEL = @DEBUGLEVEL@
34
35 VPATH = @top_srcdir@/src:@top_srcdir@/src/pkginfo:@top_srcdir@/tinyxml
36
37 CC = @CC@
38 CFLAGS = @CFLAGS@
39 CPPFLAGS = @CPPFLAGS@ -D DEBUGLEVEL=$(DEBUGLEVEL) $(INCLUDES)
40
41 CXX = @CXX@
42 CXXFLAGS = $(CFLAGS)
43
44 INCLUDES = -I ${srcdir}/src -I ${srcdir}/src/pkginfo -I ${srcdir}/tinyxml
45
46 LEX = @LEX@
47
48 AR = @AR@
49 ARFLAGS = @ARFLAGS@
50
51 OBJEXT = @OBJEXT@
52 EXEEXT = @EXEEXT@
53
54 LDFLAGS = @LDFLAGS@
55 LIBS = -Wl,-Bstatic -llua -lz -lbz2 -llzma -Wl,-Bdynamic -lwininet
56
57 CORE_DLL_OBJECTS  =  climain.$(OBJEXT) pkgshow.$(OBJEXT) dmh.$(OBJEXT) \
58    pkgbind.$(OBJEXT) pkginet.$(OBJEXT) pkgstrm.$(OBJEXT) pkgname.$(OBJEXT) \
59    pkgexec.$(OBJEXT) pkgfind.$(OBJEXT) pkginfo.$(OBJEXT) pkgspec.$(OBJEXT) \
60    sysroot.$(OBJEXT) pkghash.$(OBJEXT) pkgkeys.$(OBJEXT) pkgdeps.$(OBJEXT) \
61    mkpath.$(OBJEXT)  pkgreqs.$(OBJEXT) pkginst.$(OBJEXT) pkgunst.$(OBJEXT) \
62    tarproc.$(OBJEXT) xmlfile.$(OBJEXT) keyword.$(OBJEXT) vercmp.$(OBJEXT) \
63    tinyxml.$(OBJEXT) tinyxmlparser.$(OBJEXT) \
64    tinystr.$(OBJEXT) tinyxmlerror.$(OBJEXT)
65
66 script_srcdir = ${srcdir}/scripts/libexec
67
68 BIN_PROGRAMS = pkginfo$(EXEEXT) mingw-get$(EXEEXT)
69 LIBEXEC_PROGRAMS = gui$(EXEEXT) lastrites$(EXEEXT)
70 LIBEXEC_SCRIPTS = ${script_srcdir}/setup.lua ${script_srcdir}/wsh.lua \
71    ${script_srcdir}/shlink.js ${script_srcdir}/unlink.js
72 LIBEXEC_DATA = mingw-get-0.dll
73
74 all: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA)
75
76 pkginfo$(EXEEXT):  driver.$(OBJEXT) pkginfo.$(OBJEXT)
77         $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
78
79 mingw-get$(EXEEXT): clistub.$(OBJEXT) version.$(OBJEXT) getopt.$(OBJEXT)
80         $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $+
81
82 GUI_LDFLAGS = -mwindows $(LDFLAGS)
83
84 gui$(EXEEXT): guimain.$(OBJEXT)
85         $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+
86
87 lastrites$(EXEEXT): rites.$(OBJEXT)
88         $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
89
90 mingw-get-0.dll: $(CORE_DLL_OBJECTS)
91         $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS)
92
93 # Compilation and dependency tracking...
94 #
95 DEPFLAGS = -MM -MP -MD
96 sinclude *.d
97
98 %.$(OBJEXT): %.c
99         $(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
100         $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
101
102 %.$(OBJEXT): %.cpp
103         $(CXX) $(DEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $<
104         $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
105
106 # Installation tools and directory paths...
107 #
108 mkinstalldirs = @MKDIR_P@
109
110 prefix = @prefix@
111 exec_prefix = @exec_prefix@
112 localstatedir = @localstatedir@
113 libexecdir = @libexecdir@
114 bindir = @bindir@
115
116 PACKAGE_CONFIG_DIR = ${localstatedir}/lib/${PACKAGE_TARNAME}/data
117
118 INSTALL = @INSTALL@
119 INSTALL_DATA = @INSTALL_DATA@
120 INSTALL_PROGRAM = @INSTALL_PROGRAM@
121 INSTALL_SCRIPT = @INSTALL_SCRIPT@
122
123 STRIP = @STRIP@
124 LN_S = @LN_S@
125
126 # Installation rules...
127 #
128 installdirs:
129         $(mkinstalldirs) ${bindir}
130         $(mkinstalldirs) ${libexecdir}/${PACKAGE_TARNAME}
131         $(mkinstalldirs) ${PACKAGE_CONFIG_DIR}
132
133 install: installdirs install-profile
134         for image in $(BIN_PROGRAMS); do \
135           $(INSTALL_PROGRAM) $$image ${bindir}; \
136           done
137         for image in $(LIBEXEC_PROGRAMS); do \
138           $(INSTALL_PROGRAM) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
139           done
140         for image in $(LIBEXEC_DATA) $(LIBEXEC_SCRIPTS); do \
141           $(INSTALL_DATA) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
142           done
143
144 install-profile:
145         $(INSTALL_DATA) ${srcdir}/xml/profile.xml \
146           ${PACKAGE_CONFIG_DIR}/defaults.xml
147
148 install-strip: install
149         for image in $(BIN_PROGRAMS); do \
150           $(STRIP) ${bindir}/$$image; \
151           done
152         for image in $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA); do \
153           $(STRIP) ${libexecdir}/${PACKAGE_TARNAME}/$$image; \
154           done
155
156 # Packaging and distribution...
157 #
158 LICENCE_FILES = README COPYING
159 SRCDIST_FILES = $(LICENCE_FILES) ChangeLog NEWS INSTALL \
160   aclocal.m4 configure.ac configure Makefile.in version.c.in
161
162 SRCDIST_SUBDIRS = build-aux m4 src src/pkginfo srcdist-doc \
163   scripts/libexec tinyxml xml
164
165 # The names of distributed pacakge archive files incorporate version
166 # information, derived from PACKAGE_VERSION; this is decomposed, so that
167 # the PACKAGE_SUBSYSTEM may be interposed between the principal version
168 # number and any qualifying suffix, which specifies development status.
169 # Additionally, the package maintainer may specify, (at `make dist' time),
170 # a SNAPSHOT qualifier; if specified, this will be appended, (literally),
171 # to the principal version number component of the package version number,
172 # as it appears in the distributed archive file names.
173 #
174 PACKAGE_DISTROOT = $(PACKAGE_TARNAME)-$(PACKAGE_ROOTVERSION)
175 PACKAGE_ROOTVERSION = `echo $(PACKAGE_VERSION) | sed 's,-[^0-9].*,,'`
176 PACKAGE_DISTVERSION = `echo $(PACKAGE_VERSION)-$(PACKAGE_SUBSYSTEM) | sed \
177   -e 's,-[^0-9],-$(PACKAGE_SUBSYSTEM)&,' \
178   -e 's,\(-$(PACKAGE_SUBSYSTEM).*\)-$(PACKAGE_SUBSYSTEM),\1,' \
179   -e 's,-$(PACKAGE_SUBSYSTEM),$(SNAPSHOT)&,'`
180 PACKAGE_DISTNAME = $(PACKAGE_TARNAME)-$(PACKAGE_DISTVERSION)
181
182 dist: srcdist bindist readme.txt
183
184 # Specify default compression command, and associated file name extension,
185 # for creation and identification of packaged tar archives.
186 #
187 TARZIP = xz
188 TAREXT = tar.$(TARZIP)
189
190 bindist: all licdist
191         rm -rf staged
192         $(MAKE) --no-print-directory prefix=`pwd`/staged install-strip
193         cd staged; tar chf - bin/pkginfo$(EXEEXT) | $(TARZIP) -c > \
194           ../pkginfo-$(PACKAGE_DISTVERSION)-bin.$(TAREXT)
195         rm staged/bin/pkginfo$(EXEEXT)
196         cd staged; tar chf - * | $(TARZIP) -c > \
197           ../$(PACKAGE_DISTNAME)-bin.$(TAREXT)
198         cd staged; zip -r ../$(PACKAGE_DISTNAME)-bin.zip *
199         rm -rf staged
200
201 licdist:
202         rm -rf share
203         $(mkinstalldirs) ./share/doc/${PACKAGE_TARNAME}
204         cd ./share/doc/${PACKAGE_TARNAME}; for file in $(LICENCE_FILES); \
205           do test -f ${abs_top_srcdir}/$$file \
206             && $(LN_S) ${abs_top_srcdir}/$$file . \
207             || $(LN_S) ${CURDIR}/$$file .; \
208           done
209         tar chf - share | $(TARZIP) -c > $(PACKAGE_DISTNAME)-lic.$(TAREXT)
210         rm -rf share
211
212 srcdist: srcdist-doc
213         rm -rf ${PACKAGE_DISTROOT} && mkdir ${PACKAGE_DISTROOT}
214         cd ${PACKAGE_DISTROOT}; for file in $(SRCDIST_FILES); do \
215           test -f ${abs_top_srcdir}/$$file \
216             && $(LN_S) ${abs_top_srcdir}/$$file . \
217             || $(LN_S) ../$$file .; \
218           done
219         for dir in $(SRCDIST_SUBDIRS); do \
220           mkdir ${PACKAGE_DISTROOT}/$$dir && cd ${PACKAGE_DISTROOT}/$$dir; \
221           for file in `cd ${abs_top_srcdir}/$$dir && echo *`; do \
222             if test -f ${abs_top_srcdir}/$$dir/$$file; then \
223               $(LN_S) ${abs_top_srcdir}/$$dir/$$file .; \
224             fi; \
225           done; \
226         cd ${CURDIR}; done
227         cd ${PACKAGE_DISTROOT}/src/pkginfo; $(LN_S) ${CURDIR}/pkginfo.c .
228         tar chf - ${PACKAGE_DISTROOT} | $(TARZIP) -c > \
229           ${PACKAGE_DISTNAME}-src.$(TAREXT)
230         rm -rf ${PACKAGE_DISTROOT}
231
232 # README, INSTALL and NEWS files to be included in the source distribution
233 # are generated on demand, as indirect side effects of a set of phoney goals
234 # so that they are always regenerated for each distribution, from templates
235 # in srcdist-doc so that we can make them version specific.
236 #
237 vpath %.in ${srcdir}/srcdist-doc
238 srcdist-doc: README.dist NEWS.dist INSTALL.dist
239
240 # We need to ensure that, when we invoke nroff, the generated output
241 # will be suited to an ASCII class of typesetter; without the -Tascii
242 # option, GNU nroff will substitute Unicode hyphens (u2010) in place
243 # of ASCII hyphens (code 45).
244 #
245 NROFF = nroff -Tascii
246
247 %.dist: %.in gendoc.simple.sed
248         sed -f gendoc.simple.sed $< | $(NROFF) > $*
249
250 %.simple.sed: %.sed.in
251         sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
252             -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", $< > $@
253
254 %.combined.sed: %.sed.in
255         sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
256             -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", \
257             -e s,'^# *cut:',, $< > $@
258
259 # The following rules use sed and awk to match the RCS Id keyword;
260 # we define and use the following macro, in the form "$(DOLLAR)Id:",
261 # to avoid unwanted substitution on CVS checkout.
262 #
263 DOLLAR = $$
264
265 # The following rule provides a mechanism for generating a composite from
266 # README, INSTALL and NEWS, for use as an on-line package description.
267 #
268 readme.txt: gendoc.combined.sed readme.txt.tag readme.txt.in
269         sed s,'$(DOLLAR)Id:.*',"`cat $@.tag`", $@.in > $@
270         echo '$$Document: $@ $$: end of file' >> $@
271         rm -f gendoc.combined.sed $@.*
272
273 # There should be a new generation of readme.txt for each package release;
274 # since each release should also include an updated NEWS file; we adopt the
275 # ID tag-line from NEWS.in, as most the appropriate template for generation
276 # of a corresponding tag-line for readme.in
277 #
278 readme.txt.tag: NEWS.in
279         awk '/\$(DOLLAR)Id:/{ $$2 = "readme.txt\\,v"; print }' $^ > $@
280
281 # The tag-line generated by the preceding rule may then be substituted, by
282 # the primary readme.txt generation rule above, into the document template
283 # generated by the following rule
284 #
285 readme.txt.in: README.in NEWS.in INSTALL.in
286         rm -f $@
287         for input in $^; do \
288           sed -f gendoc.combined.sed $$input | $(NROFF) >> $@; \
289           done
290
291 # Workspace clean-up...
292 #
293 clean:
294         rm -f *.$(OBJEXT) *.d *.dll $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
295
296 distclean: clean
297         rm -f config.* version.c
298
299 maintainer-clean: distclean
300         rm -f README NEWS INSTALL readme.txt Makefile pkginfo.c
301         rm -f *-$(PACKAGE_DISTVERSION)-*.tar.* *-$(PACKAGE_DISTVERSION)-*.zip
302         rm -rf ${PACKAGE_DISTROOT} staged ${srcdir}/autom4te.cache
303
304 # $RCSfile$: end of file