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)
70 clistub.$(OBJEXT) version.$(OBJEXT) approot.$(OBJEXT) getopt.$(OBJEXT)
72 script_srcdir = ${srcdir}/scripts/libexec
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
80 all: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA)
82 pkginfo$(EXEEXT): driver.$(OBJEXT) pkginfo.$(OBJEXT)
83 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
85 mingw-get$(EXEEXT): $(CLI_EXE_OBJECTS)
86 $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $+
88 GUI_LDFLAGS = -mwindows $(LDFLAGS)
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.
98 echo $* ICON $*.ico | $(WINDRES) -I ${srcdir}/icons -o $@
100 gui$(EXEEXT): guimain.$(OBJEXT) pkgicon.$(OBJEXT)
101 $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+
103 lastrites$(EXEEXT): rites.$(OBJEXT)
104 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
106 mingw-get-0.dll: $(CORE_DLL_OBJECTS)
107 $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS)
109 # Compilation and dependency tracking...
111 DEPFLAGS = -MM -MP -MD
115 $(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
116 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
119 $(CXX) $(DEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $<
120 $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
122 # Installation tools and directory paths...
124 mkinstalldirs = @MKDIR_P@
127 exec_prefix = @exec_prefix@
128 localstatedir = @localstatedir@
129 libexecdir = @libexecdir@
132 PACKAGE_CONFIG_DIR = ${localstatedir}/lib/${PACKAGE_TARNAME}/data
135 INSTALL_DATA = @INSTALL_DATA@
136 INSTALL_PROGRAM = @INSTALL_PROGRAM@
137 INSTALL_SCRIPT = @INSTALL_SCRIPT@
142 # Installation rules...
145 $(mkinstalldirs) ${bindir}
146 $(mkinstalldirs) ${libexecdir}/${PACKAGE_TARNAME}
147 $(mkinstalldirs) ${PACKAGE_CONFIG_DIR}
149 install: installdirs install-profile
150 for image in $(BIN_PROGRAMS); do \
151 $(INSTALL_PROGRAM) $$image ${bindir}; \
153 for image in $(LIBEXEC_PROGRAMS); do \
154 $(INSTALL_PROGRAM) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
156 for image in $(LIBEXEC_DATA) $(LIBEXEC_SCRIPTS); do \
157 $(INSTALL_DATA) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
161 $(INSTALL_DATA) ${srcdir}/xml/profile.xml \
162 ${PACKAGE_CONFIG_DIR}/defaults.xml
164 install-strip: install
165 for image in $(BIN_PROGRAMS); do \
166 $(STRIP) ${bindir}/$$image; \
168 for image in $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA); do \
169 $(STRIP) ${libexecdir}/${PACKAGE_TARNAME}/$$image; \
172 # Packaging and distribution...
174 LICENCE_FILES = README COPYING
175 SRCDIST_FILES = $(LICENCE_FILES) ChangeLog NEWS INSTALL \
176 aclocal.m4 configure.ac configure Makefile.in version.c.in
178 SRCDIST_SUBDIRS = build-aux icons m4 src src/pkginfo srcdist-doc \
179 scripts/libexec tinyxml xml
181 # The names of distributed pacakge 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.
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)
198 dist: srcdist bindist readme.txt
200 # Specify default compression command, and associated file name extension,
201 # for creation and identification of packaged tar archives.
204 TAREXT = tar.$(TARZIP)
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 *
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 .; \
225 tar chf - share | $(TARZIP) -c > $(PACKAGE_DISTNAME)-lic.$(TAREXT)
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 .; \
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 .; \
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}
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.
254 vpath %.in ${srcdir}/srcdist-doc
255 srcdist-doc: README.dist NEWS.dist INSTALL.dist
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).
262 NROFF = nroff -Tascii
264 %.dist: %.in gendoc.simple.sed
265 sed -f gendoc.simple.sed $< | $(NROFF) > $*
267 %.simple.sed: %.sed.in
268 sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
269 -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", $< > $@
271 %.combined.sed: %.sed.in
272 sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
273 -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", \
274 -e s,'^# *cut:',, $< > $@
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.
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.
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 $@.*
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
295 readme.txt.tag: NEWS.in
296 awk '/\$(DOLLAR)Id:/{ $$2 = "readme.txt\\,v"; print }' $^ > $@
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
302 readme.txt.in: README.in NEWS.in INSTALL.in
304 for input in $^; do \
305 sed -f gendoc.combined.sed $$input | $(NROFF) >> $@; \
308 # Workspace clean-up...
311 rm -f *.$(OBJEXT) *.d *.dll $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
314 rm -f config.* version.c
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
321 # $RCSfile$: end of file