OSDN Git Service

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