5 PACKAGE_TARNAME = @PACKAGE_TARNAME@
6 PACKAGE_VERSION = @PACKAGE_VERSION@
8 # Written by Keith Marshall <keithmarshall@users.sourceforge.net>
9 # Copyright (C) 2009, 2010, 2011, 2012, MinGW Project
12 # Makefile template for mingw-get
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.
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.
28 PACKAGE_SUBSYSTEM = @host_os@
31 abs_top_srcdir = @abs_top_srcdir@
33 DEBUGLEVEL = @DEBUGLEVEL@
35 vpath %.ico @srcdir@/icons
36 VPATH = @top_srcdir@/src:@top_srcdir@/src/pkginfo:@top_srcdir@/tinyxml
40 CPPFLAGS = @CPPFLAGS@ -D DEBUGLEVEL=$(DEBUGLEVEL) $(INCLUDES)
45 INCLUDES = -I ${srcdir}/src -I ${srcdir}/src/pkginfo -I ${srcdir}/tinyxml
58 LIBS = -Wl,-Bstatic -llua -lz -lbz2 -llzma -Wl,-Bdynamic -lwininet
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)
69 script_srcdir = ${srcdir}/scripts/libexec
71 BIN_PROGRAMS = pkginfo$(EXEEXT) mingw-get$(EXEEXT)
72 LIBEXEC_PROGRAMS = gui$(EXEEXT) lastrites$(EXEEXT)
73 LIBEXEC_SCRIPTS = ${script_srcdir}/setup.lua ${script_srcdir}/wsh.lua \
74 ${script_srcdir}/shlink.js ${script_srcdir}/unlink.js
75 LIBEXEC_DATA = mingw-get-0.dll
77 all: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA)
79 pkginfo$(EXEEXT): driver.$(OBJEXT) pkginfo.$(OBJEXT)
80 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
82 mingw-get$(EXEEXT): clistub.$(OBJEXT) version.$(OBJEXT) getopt.$(OBJEXT)
83 $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $+
85 GUI_LDFLAGS = -mwindows $(LDFLAGS)
87 # FIXME: the following is a Q&D kludge, to assign my choice of icon
88 # to the GUI mode executable stub. Eventually, this will need to be
89 # assigned within a resource definition file, but for the time being,
90 # besides providing a notification that the GUI is not yet available,
91 # the stub serves only to illustrate mingw-get's shortcut creation
92 # capability; thus, this simple hack will suffice.
95 echo $* ICON $*.ico | $(WINDRES) -I ${srcdir}/icons -o $@
97 gui$(EXEEXT): guimain.$(OBJEXT) pkgicon.$(OBJEXT)
98 $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+
100 lastrites$(EXEEXT): rites.$(OBJEXT)
101 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
103 mingw-get-0.dll: $(CORE_DLL_OBJECTS)
104 $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS)
106 # Compilation and dependency tracking...
108 DEPFLAGS = -MM -MP -MD
112 $(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
113 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
116 $(CXX) $(DEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $<
117 $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
119 # Installation tools and directory paths...
121 mkinstalldirs = @MKDIR_P@
124 exec_prefix = @exec_prefix@
125 localstatedir = @localstatedir@
126 libexecdir = @libexecdir@
129 PACKAGE_CONFIG_DIR = ${localstatedir}/lib/${PACKAGE_TARNAME}/data
132 INSTALL_DATA = @INSTALL_DATA@
133 INSTALL_PROGRAM = @INSTALL_PROGRAM@
134 INSTALL_SCRIPT = @INSTALL_SCRIPT@
139 # Installation rules...
142 $(mkinstalldirs) ${bindir}
143 $(mkinstalldirs) ${libexecdir}/${PACKAGE_TARNAME}
144 $(mkinstalldirs) ${PACKAGE_CONFIG_DIR}
146 install: installdirs install-profile
147 for image in $(BIN_PROGRAMS); do \
148 $(INSTALL_PROGRAM) $$image ${bindir}; \
150 for image in $(LIBEXEC_PROGRAMS); do \
151 $(INSTALL_PROGRAM) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
153 for image in $(LIBEXEC_DATA) $(LIBEXEC_SCRIPTS); do \
154 $(INSTALL_DATA) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
158 $(INSTALL_DATA) ${srcdir}/xml/profile.xml \
159 ${PACKAGE_CONFIG_DIR}/defaults.xml
161 install-strip: install
162 for image in $(BIN_PROGRAMS); do \
163 $(STRIP) ${bindir}/$$image; \
165 for image in $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA); do \
166 $(STRIP) ${libexecdir}/${PACKAGE_TARNAME}/$$image; \
169 # Packaging and distribution...
171 LICENCE_FILES = README COPYING
172 SRCDIST_FILES = $(LICENCE_FILES) ChangeLog NEWS INSTALL \
173 aclocal.m4 configure.ac configure Makefile.in version.c.in
175 SRCDIST_SUBDIRS = build-aux icons m4 src src/pkginfo srcdist-doc \
176 scripts/libexec tinyxml xml
178 # The names of distributed pacakge archive files incorporate version
179 # information, derived from PACKAGE_VERSION; this is decomposed, so that
180 # the PACKAGE_SUBSYSTEM may be interposed between the principal version
181 # number and any qualifying suffix, which specifies development status.
182 # Additionally, the package maintainer may specify, (at `make dist' time),
183 # a SNAPSHOT qualifier; if specified, this will be appended, (literally),
184 # to the principal version number component of the package version number,
185 # as it appears in the distributed archive file names.
187 PACKAGE_DISTROOT = $(PACKAGE_TARNAME)-$(PACKAGE_ROOTVERSION)
188 PACKAGE_ROOTVERSION = `echo $(PACKAGE_VERSION) | sed 's,-[^0-9].*,,'`
189 PACKAGE_DISTVERSION = `echo $(PACKAGE_VERSION)-$(PACKAGE_SUBSYSTEM) | sed \
190 -e 's,-[^0-9],-$(PACKAGE_SUBSYSTEM)&,' \
191 -e 's,\(-$(PACKAGE_SUBSYSTEM).*\)-$(PACKAGE_SUBSYSTEM),\1,' \
192 -e 's,-$(PACKAGE_SUBSYSTEM),$(SNAPSHOT)&,'`
193 PACKAGE_DISTNAME = $(PACKAGE_TARNAME)-$(PACKAGE_DISTVERSION)
195 dist: srcdist bindist readme.txt
197 # Specify default compression command, and associated file name extension,
198 # for creation and identification of packaged tar archives.
201 TAREXT = tar.$(TARZIP)
205 $(MAKE) --no-print-directory prefix=`pwd`/staged install-strip
206 cd staged; tar chf - bin/pkginfo$(EXEEXT) | $(TARZIP) -c > \
207 ../pkginfo-$(PACKAGE_DISTVERSION)-bin.$(TAREXT)
208 rm staged/bin/pkginfo$(EXEEXT)
209 cd staged; tar chf - * | $(TARZIP) -c > \
210 ../$(PACKAGE_DISTNAME)-bin.$(TAREXT)
211 cd staged; zip -r ../$(PACKAGE_DISTNAME)-bin.zip *
216 $(mkinstalldirs) ./share/doc/${PACKAGE_TARNAME}
217 cd ./share/doc/${PACKAGE_TARNAME}; for file in $(LICENCE_FILES); \
218 do test -f ${abs_top_srcdir}/$$file \
219 && $(LN_S) ${abs_top_srcdir}/$$file . \
220 || $(LN_S) ${CURDIR}/$$file .; \
222 tar chf - share | $(TARZIP) -c > $(PACKAGE_DISTNAME)-lic.$(TAREXT)
226 rm -rf ${PACKAGE_DISTROOT} && mkdir ${PACKAGE_DISTROOT}
227 cd ${PACKAGE_DISTROOT}; for file in $(SRCDIST_FILES); do \
228 test -f ${abs_top_srcdir}/$$file \
229 && $(LN_S) ${abs_top_srcdir}/$$file . \
230 || $(LN_S) ../$$file .; \
232 for dir in $(SRCDIST_SUBDIRS); do \
233 $(mkinstalldirs) ${PACKAGE_DISTROOT}/$$dir \
234 && cd ${PACKAGE_DISTROOT}/$$dir; \
235 for file in `cd ${abs_top_srcdir}/$$dir && echo *`; do \
236 if test -f ${abs_top_srcdir}/$$dir/$$file; then \
237 $(LN_S) ${abs_top_srcdir}/$$dir/$$file .; \
241 cd ${PACKAGE_DISTROOT}/src/pkginfo; $(LN_S) ${CURDIR}/pkginfo.c .
242 tar chf - ${PACKAGE_DISTROOT} | $(TARZIP) -c > \
243 ${PACKAGE_DISTNAME}-src.$(TAREXT)
244 rm -rf ${PACKAGE_DISTROOT}
246 # README, INSTALL and NEWS files to be included in the source distribution
247 # are generated on demand, as indirect side effects of a set of phoney goals
248 # so that they are always regenerated for each distribution, from templates
249 # in srcdist-doc so that we can make them version specific.
251 vpath %.in ${srcdir}/srcdist-doc
252 srcdist-doc: README.dist NEWS.dist INSTALL.dist
254 # We need to ensure that, when we invoke nroff, the generated output
255 # will be suited to an ASCII class of typesetter; without the -Tascii
256 # option, GNU nroff will substitute Unicode hyphens (u2010) in place
257 # of ASCII hyphens (code 45).
259 NROFF = nroff -Tascii
261 %.dist: %.in gendoc.simple.sed
262 sed -f gendoc.simple.sed $< | $(NROFF) > $*
264 %.simple.sed: %.sed.in
265 sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
266 -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", $< > $@
268 %.combined.sed: %.sed.in
269 sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
270 -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", \
271 -e s,'^# *cut:',, $< > $@
273 # The following rules use sed and awk to match the RCS Id keyword;
274 # we define and use the following macro, in the form "$(DOLLAR)Id:",
275 # to avoid unwanted substitution on CVS checkout.
279 # The following rule provides a mechanism for generating a composite from
280 # README, INSTALL and NEWS, for use as an on-line package description.
282 readme.txt: gendoc.combined.sed readme.txt.tag readme.txt.in
283 sed s,'$(DOLLAR)Id:.*',"`cat $@.tag`", $@.in > $@
284 echo '$$Document: $@ $$: end of file' >> $@
285 rm -f gendoc.combined.sed $@.*
287 # There should be a new generation of readme.txt for each package release;
288 # since each release should also include an updated NEWS file; we adopt the
289 # ID tag-line from NEWS.in, as most the appropriate template for generation
290 # of a corresponding tag-line for readme.in
292 readme.txt.tag: NEWS.in
293 awk '/\$(DOLLAR)Id:/{ $$2 = "readme.txt\\,v"; print }' $^ > $@
295 # The tag-line generated by the preceding rule may then be substituted, by
296 # the primary readme.txt generation rule above, into the document template
297 # generated by the following rule
299 readme.txt.in: README.in NEWS.in INSTALL.in
301 for input in $^; do \
302 sed -f gendoc.combined.sed $$input | $(NROFF) >> $@; \
305 # Workspace clean-up...
308 rm -f *.$(OBJEXT) *.d *.dll $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
311 rm -f config.* version.c
313 maintainer-clean: distclean
314 rm -f README NEWS INSTALL readme.txt Makefile pkginfo.c
315 rm -f *-$(PACKAGE_DISTVERSION)-*.tar.* *-$(PACKAGE_DISTVERSION)-*.zip
316 rm -rf ${PACKAGE_DISTROOT} staged ${srcdir}/autom4te.cache
318 # $RCSfile$: end of file