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 = @top_srcdir@/src:@top_srcdir@/src/pkginfo:@top_srcdir@/tinyxml
39 CPPFLAGS = @CPPFLAGS@ -D DEBUGLEVEL=$(DEBUGLEVEL) $(INCLUDES)
44 INCLUDES = -I ${srcdir}/src -I ${srcdir}/src/pkginfo -I ${srcdir}/tinyxml
55 LIBS = -Wl,-Bstatic -llua -lz -lbz2 -llzma -Wl,-Bdynamic -lwininet
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)
66 script_srcdir = ${srcdir}/scripts/libexec
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
74 all: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA)
76 pkginfo$(EXEEXT): driver.$(OBJEXT) pkginfo.$(OBJEXT)
77 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
79 mingw-get$(EXEEXT): clistub.$(OBJEXT) version.$(OBJEXT) getopt.$(OBJEXT)
80 $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $+
82 GUI_LDFLAGS = -mwindows $(LDFLAGS)
84 gui$(EXEEXT): guimain.$(OBJEXT)
85 $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+
87 lastrites$(EXEEXT): rites.$(OBJEXT)
88 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
90 mingw-get-0.dll: $(CORE_DLL_OBJECTS)
91 $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS)
93 # Compilation and dependency tracking...
95 DEPFLAGS = -MM -MP -MD
99 $(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
100 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
103 $(CXX) $(DEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $<
104 $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
106 # Installation tools and directory paths...
108 mkinstalldirs = @MKDIR_P@
111 exec_prefix = @exec_prefix@
112 localstatedir = @localstatedir@
113 libexecdir = @libexecdir@
116 PACKAGE_CONFIG_DIR = ${localstatedir}/lib/${PACKAGE_TARNAME}/data
119 INSTALL_DATA = @INSTALL_DATA@
120 INSTALL_PROGRAM = @INSTALL_PROGRAM@
121 INSTALL_SCRIPT = @INSTALL_SCRIPT@
126 # Installation rules...
129 $(mkinstalldirs) ${bindir}
130 $(mkinstalldirs) ${libexecdir}/${PACKAGE_TARNAME}
131 $(mkinstalldirs) ${PACKAGE_CONFIG_DIR}
133 install: installdirs install-profile
134 for image in $(BIN_PROGRAMS); do \
135 $(INSTALL_PROGRAM) $$image ${bindir}; \
137 for image in $(LIBEXEC_PROGRAMS); do \
138 $(INSTALL_PROGRAM) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
140 for image in $(LIBEXEC_DATA) $(LIBEXEC_SCRIPTS); do \
141 $(INSTALL_DATA) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
145 $(INSTALL_DATA) ${srcdir}/xml/profile.xml \
146 ${PACKAGE_CONFIG_DIR}/defaults.xml
148 install-strip: install
149 for image in $(BIN_PROGRAMS); do \
150 $(STRIP) ${bindir}/$$image; \
152 for image in $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA); do \
153 $(STRIP) ${libexecdir}/${PACKAGE_TARNAME}/$$image; \
156 # Packaging and distribution...
158 LICENCE_FILES = README COPYING
159 SRCDIST_FILES = $(LICENCE_FILES) ChangeLog NEWS INSTALL \
160 aclocal.m4 configure.ac configure Makefile.in version.c.in
162 SRCDIST_SUBDIRS = build-aux m4 src src/pkginfo srcdist-doc \
163 scripts/libexec tinyxml xml
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.
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)
182 dist: srcdist bindist readme.txt
184 # Specify default compression command, and associated file name extension,
185 # for creation and identification of packaged tar archives.
188 TAREXT = tar.$(TARZIP)
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 *
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 .; \
209 tar chf - share | $(TARZIP) -c > $(PACKAGE_DISTNAME)-lic.$(TAREXT)
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 .; \
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 .; \
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}
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.
237 vpath %.in ${srcdir}/srcdist-doc
238 srcdist-doc: README.dist NEWS.dist INSTALL.dist
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).
245 NROFF = nroff -Tascii
247 %.dist: %.in gendoc.simple.sed
248 sed -f gendoc.simple.sed $< | $(NROFF) > $*
250 %.simple.sed: %.sed.in
251 sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
252 -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", $< > $@
254 %.combined.sed: %.sed.in
255 sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
256 -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", \
257 -e s,'^# *cut:',, $< > $@
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.
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.
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 $@.*
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
278 readme.txt.tag: NEWS.in
279 awk '/\$(DOLLAR)Id:/{ $$2 = "readme.txt\\,v"; print }' $^ > $@
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
285 readme.txt.in: README.in NEWS.in INSTALL.in
287 for input in $^; do \
288 sed -f gendoc.combined.sed $$input | $(NROFF) >> $@; \
291 # Workspace clean-up...
294 rm -f *.$(OBJEXT) *.d *.dll $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
297 rm -f config.* version.c
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
304 # $RCSfile$: end of file