PACKAGE_VERSION = @PACKAGE_VERSION@
# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
-# Copyright (C) 2009, 2010, 2011, MinGW Project
+# Copyright (C) 2009, 2010, 2011, 2012, MinGW.org Project
#
#
# Makefile template for mingw-get
# hope that it may prove useful, but WITHOUT WARRANTY OF ANY KIND; not
# even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
# PARTICULAR PURPOSE. Under no circumstances will the author, or the
-# MinGW Project, accept liability for any damages, however caused,
+# MinGW.org Project, accept liability for any damages, however caused,
# arising from the use of this software.
#
PACKAGE_SUBSYSTEM = @host_os@
+CLI_RELEASE_CLASS = @CLI_RELEASE_CLASS@
+GUI_RELEASE_CLASS = @GUI_RELEASE_CLASS@
+
+BUILD_TAG = `>> build.tag; cat build.tag`
+DEBUGLEVEL = @DEBUGLEVEL@
+
srcdir = @srcdir@
abs_top_srcdir = @abs_top_srcdir@
-DEBUGLEVEL = 0
-
+vpath %.ico @srcdir@/icons
VPATH = @top_srcdir@/src:@top_srcdir@/src/pkginfo:@top_srcdir@/tinyxml
CC = @CC@
AR = @AR@
ARFLAGS = @ARFLAGS@
+RC = @RC@
+RC_SCRIPT = tag=$(BUILD_TAG); \
+ test "x$$tag" != x && tag="-$(GUI_RELEASE_CLASS)-$$tag"; \
+ $(TAG_SCRIPT)
+
+VERSION_SCRIPT = tag=$(BUILD_TAG); \
+ test "x$$tag" != x && tag="-$(CLI_RELEASE_CLASS)-$$tag"; \
+ $(TAG_SCRIPT)
+
+TAG_SCRIPT = sed \
+ -e "s!%PACKAGE_NAME%!$(PACKAGE_TARNAME)!g" \
+ -e "s!%PACKAGE_VERSION%!$(PACKAGE_VERSION)$$tag!g" \
+ -e "s!%COPYRIGHT_HOLDER%!@COPYRIGHT_HOLDER@!g" \
+ -e "s!%YEARS_OF_ISSUE%!@YEARS_OF_ISSUE@!g"
+
+RC_INCLUDES = -I ${srcdir}/src -I ${srcdir}/icons
+
OBJEXT = @OBJEXT@
EXEEXT = @EXEEXT@
LDFLAGS = @LDFLAGS@
-LIBS = -Wl,-Bstatic -lz -lbz2 -llzma -Wl,-Bdynamic -lwininet
+GUI_LDFLAGS = -mwindows $(LDFLAGS)
+LIBS = -Wl,-Bstatic -llua -lz -lbz2 -llzma -Wl,-Bdynamic -lwininet
CORE_DLL_OBJECTS = climain.$(OBJEXT) pkgshow.$(OBJEXT) dmh.$(OBJEXT) \
pkgbind.$(OBJEXT) pkginet.$(OBJEXT) pkgstrm.$(OBJEXT) pkgname.$(OBJEXT) \
pkgexec.$(OBJEXT) pkgfind.$(OBJEXT) pkginfo.$(OBJEXT) pkgspec.$(OBJEXT) \
- sysroot.$(OBJEXT) pkghash.$(OBJEXT) pkgkeys.$(OBJEXT) pkgdeps.$(OBJEXT) \
- mkpath.$(OBJEXT) pkgreqs.$(OBJEXT) pkginst.$(OBJEXT) pkgunst.$(OBJEXT) \
+ pkgopts.$(OBJEXT) sysroot.$(OBJEXT) pkghash.$(OBJEXT) pkgkeys.$(OBJEXT) \
+ pkgdeps.$(OBJEXT) pkgreqs.$(OBJEXT) pkginst.$(OBJEXT) pkgunst.$(OBJEXT) \
tarproc.$(OBJEXT) xmlfile.$(OBJEXT) keyword.$(OBJEXT) vercmp.$(OBJEXT) \
- tinyxml.$(OBJEXT) tinyxmlparser.$(OBJEXT) \
- tinystr.$(OBJEXT) tinyxmlerror.$(OBJEXT)
+ tinyxml.$(OBJEXT) tinystr.$(OBJEXT) tinyxmlparser.$(OBJEXT) \
+ mkpath.$(OBJEXT) tinyxmlerror.$(OBJEXT)
+
+CLI_EXE_OBJECTS = \
+ clistub.$(OBJEXT) version.$(OBJEXT) approot.$(OBJEXT) getopt.$(OBJEXT)
+
+GUIMAIN_OBJECTS = \
+ guimain.$(OBJEXT) guidata.$(OBJEXT) guiexec.$(OBJEXT) guidmh.$(OBJEXT) \
+ approot.$(OBJEXT) pkgview.$(OBJEXT) pkgtree.$(OBJEXT) pkglist.$(OBJEXT) \
+ pkgdata.$(OBJEXT) pkgnget.$(OBJEXT)
+
+GUIMAIN_LIBS = -lwtklite -lcomctl32
+
+script_srcdir = ${srcdir}/scripts/libexec
BIN_PROGRAMS = pkginfo$(EXEEXT) mingw-get$(EXEEXT)
-LIBEXEC_PROGRAMS = gui$(EXEEXT) lastrites$(EXEEXT)
+LIBEXEC_PROGRAMS = guistub$(EXEEXT) guimain$(EXEEXT) lastrites$(EXEEXT)
+LIBEXEC_SCRIPTS = ${script_srcdir}/setup.lua ${script_srcdir}/wsh.lua \
+ ${script_srcdir}/shlink.js ${script_srcdir}/unlink.js
LIBEXEC_DATA = mingw-get-0.dll
+# Primary build goals...
+#
all: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA)
pkginfo$(EXEEXT): driver.$(OBJEXT) pkginfo.$(OBJEXT)
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
-mingw-get$(EXEEXT): clistub.$(OBJEXT) version.$(OBJEXT)
+mingw-get$(EXEEXT): $(CLI_EXE_OBJECTS)
$(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $+
-GUI_LDFLAGS = -mwindows $(LDFLAGS)
-
-gui$(EXEEXT): guimain.$(OBJEXT)
+guistub$(EXEEXT): guistub.$(OBJEXT) pkgicon.$(OBJEXT)
$(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+
+guimain$(EXEEXT): $(GUIMAIN_OBJECTS) $(LIBEXEC_DATA)
+ $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+ $(GUIMAIN_LIBS)
+
lastrites$(EXEEXT): rites.$(OBJEXT)
- $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
+ $(CC) -o $@ $(CFLAGS) $(GUI_LDFLAGS) $+
mingw-get-0.dll: $(CORE_DLL_OBJECTS)
$(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS)
$(CXX) $(DEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $<
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
+%.$(OBJEXT): %.rc
+ $(CC) $(DEPFLAGS) $(RC_INCLUDES) -DRC_INVOKED -xc-header $<
+ $(RC_SCRIPT) $< | $(RC) $(RC_INCLUDES) -o $@
+
+%.$(OBJEXT): %.ico
+ echo $* ICON $*.ico | $(RC) -I ${srcdir}/icons -o $@
+
+# Release tagging...
+#
+time-stamp:
+%.tagged.time: time-stamp
+ > $*.time
+
+%.time:
+ > $*.time
+
+%.tag: %.tagged.time
+ >> $@; tag=`date +%Y%m%d`; \
+ tag=`awk -F- -v today=$$tag ' \
+ BEGIN { tag = 1 } $$1 == today { tag += $$2 } \
+ END { print today "-" tag }' $@`; \
+ echo $$tag > $@
+
+%.c: %.c.in
+ $(VERSION_SCRIPT) $< > $@
+
+version.c: build.time
+guidata.$(OBJEXT): build.time
+
# Installation tools and directory paths...
#
mkinstalldirs = @MKDIR_P@
for image in $(LIBEXEC_PROGRAMS); do \
$(INSTALL_PROGRAM) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
done
- for image in $(LIBEXEC_DATA); do \
+ for image in $(LIBEXEC_DATA) $(LIBEXEC_SCRIPTS); do \
$(INSTALL_DATA) $$image ${libexecdir}/${PACKAGE_TARNAME}; \
done
done
# Packaging and distribution...
+# "Native" source files, (i.e. those specific to mingw-get), are...
#
LICENCE_FILES = README COPYING
SRCDIST_FILES = $(LICENCE_FILES) ChangeLog NEWS INSTALL \
- aclocal.m4 configure.ac configure Makefile.in version.c.in
+ aclocal.m4 configure.ac configure Makefile.in
+
+# ...plus the entire content of the sub-directories...
+#
+SRCDIST_SUBDIRS = src src/pkginfo srcdist-doc icons \
+ scripts/libexec tinyxml xml
-SRCDIST_SUBDIRS = build-aux m4 src src/pkginfo srcdist-doc tinyxml xml
+# In addition to the native sources for mingw-get, our source distribution
+# must include a filtered subset of those additional files which we import
+# from the project's global build-aux repository...
+#
+BUILD_AUX_DIRS = build-aux build-aux/m4
+BUILD_AUX_FILES = config.guess config.sub install-sh missing.m4
-# The names of distributed pacakge archive files incorporate version
+# The names of distributed package archive files incorporate version
# information, derived from PACKAGE_VERSION; this is decomposed, so that
# the PACKAGE_SUBSYSTEM may be interposed between the principal version
# number and any qualifying suffix, which specifies development status.
dist: srcdist bindist readme.txt
+# Specify default compression command, and associated file name extension,
+# for creation and identification of packaged tar archives.
+#
+TARZIP = xz
+TAREXT = tar.$(TARZIP)
+
+# The following macros facilitate the inclusion of SCM build tags within
+# the generated names for the release tarballs; the GCMTAG macro is used
+# to identify explicitly GUI components, while SCMTAG is used otherwise.
+#
+BLDTAG = @abs_top_builddir@/build.tag
+SCMTAG = `>> $(BLDTAG); cat $(BLDTAG) | sed 's,.,-$(CLI_RELEASE_CLASS)-&,'`
+GCMTAG = `>> $(BLDTAG); cat $(BLDTAG) | sed 's,.,-$(GUI_RELEASE_CLASS)-&,'`
+
bindist: all licdist
rm -rf staged
$(MAKE) --no-print-directory prefix=`pwd`/staged install-strip
- cd staged; tar chf - bin/pkginfo$(EXEEXT) | gzip -c > \
- ../pkginfo-$(PACKAGE_DISTVERSION)-bin.tar.gz
+ cd staged; tar chf - bin/pkginfo$(EXEEXT) | $(TARZIP) -c > \
+ ../pkginfo-$(PACKAGE_DISTVERSION)$(SCMTAG)-bin.$(TAREXT)
rm staged/bin/pkginfo$(EXEEXT)
- cd staged; tar chf - * | gzip -c > ../$(PACKAGE_DISTNAME)-bin.tar.gz
- cd staged; zip -r ../$(PACKAGE_DISTNAME)-bin.zip *
+ cd staged; tar chf - libexec/mingw-get/guimain$(EXEEXT) | \
+ $(TARZIP) -c > ../$(PACKAGE_DISTNAME)$(GCMTAG)-gui.$(TAREXT)
+ rm staged/libexec/mingw-get/guimain$(EXEEXT)
+ cd staged; tar chf - * | $(TARZIP) -c > \
+ ../$(PACKAGE_DISTNAME)$(SCMTAG)-bin.$(TAREXT)
+ cd staged; zip -r ../$(PACKAGE_DISTNAME)$(SCMTAG)-bin.zip *
rm -rf staged
licdist:
cd ./share/doc/${PACKAGE_TARNAME}; for file in $(LICENCE_FILES); \
do test -f ${abs_top_srcdir}/$$file \
&& $(LN_S) ${abs_top_srcdir}/$$file . \
- || $(LN_S) ../$$file .; \
+ || $(LN_S) ${CURDIR}/$$file .; \
done
- tar chf - share | gzip -c > $(PACKAGE_DISTNAME)-lic.tar.gz
+ tar chf - share | $(TARZIP) -c > \
+ $(PACKAGE_DISTNAME)$(SCMTAG)-lic.$(TAREXT)
rm -rf share
-srcdist: pkginfo.c srcdist-doc
+srcdist: srcdist-doc
rm -rf ${PACKAGE_DISTROOT} && mkdir ${PACKAGE_DISTROOT}
cd ${PACKAGE_DISTROOT}; for file in $(SRCDIST_FILES); do \
test -f ${abs_top_srcdir}/$$file \
|| $(LN_S) ../$$file .; \
done
for dir in $(SRCDIST_SUBDIRS); do \
- mkdir ${PACKAGE_DISTROOT}/$$dir && cd ${PACKAGE_DISTROOT}/$$dir; \
+ $(mkinstalldirs) ${PACKAGE_DISTROOT}/$$dir \
+ && cd ${PACKAGE_DISTROOT}/$$dir; \
for file in `cd ${abs_top_srcdir}/$$dir && echo *`; do \
if test -f ${abs_top_srcdir}/$$dir/$$file; then \
$(LN_S) ${abs_top_srcdir}/$$dir/$$file .; \
fi; \
done; \
cd ${CURDIR}; done
- cd ${PACKAGE_DISTROOT}/src/pkginfo; $(LN_S) ${CURDIR}/$^ .
- tar chf - ${PACKAGE_DISTROOT} | gzip -c > ${PACKAGE_DISTNAME}-src.tar.gz
+ for dir in $(BUILD_AUX_DIRS); do \
+ $(mkinstalldirs) ${PACKAGE_DISTROOT}/$$dir \
+ && cd ${PACKAGE_DISTROOT}/$$dir; \
+ for file in $(BUILD_AUX_FILES); do \
+ if test -f ${abs_top_srcdir}/$$dir/$$file; then \
+ $(LN_S) ${abs_top_srcdir}/$$dir/$$file .; \
+ fi; \
+ done; \
+ cd ${CURDIR}; done
+ cd ${PACKAGE_DISTROOT}/src/pkginfo; $(LN_S) ${CURDIR}/pkginfo.c .
+ tar chf - ${PACKAGE_DISTROOT} | $(TARZIP) -c > \
+ $(PACKAGE_DISTNAME)$(SCMTAG)-src.$(TAREXT)
rm -rf ${PACKAGE_DISTROOT}
# README, INSTALL and NEWS files to be included in the source distribution
-e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", \
-e s,'^# *cut:',, $< > $@
+# The following rules use sed and awk to match the RCS Id keyword;
+# we define and use the following macro, in the form "$(DOLLAR)Id:",
+# to avoid unwanted substitution on CVS checkout.
+#
+DOLLAR = $$
+
# The following rule provides a mechanism for generating a composite from
# README, INSTALL and NEWS, for use as an on-line package description.
#
-readme.txt: README.in NEWS.in INSTALL.in gendoc.combined.sed
+readme.txt: gendoc.combined.sed readme.txt.tag readme.txt.in
+ sed s,'$(DOLLAR)Id:.*',"`cat $@.tag`", $@.in > $@
+ echo '$$Document: $@ $$: end of file' >> $@
+ rm -f gendoc.combined.sed $@.*
+
+# There should be a new generation of readme.txt for each package release;
+# since each release should also include an updated NEWS file; we adopt the
+# ID tag-line from NEWS.in, as most the appropriate template for generation
+# of a corresponding tag-line for readme.in
+#
+readme.txt.tag: NEWS.in
+ awk '/\$(DOLLAR)Id:/{ $$2 = "readme.txt\\,v"; print }' $^ > $@
+
+# The tag-line generated by the preceding rule may then be substituted, by
+# the primary readme.txt generation rule above, into the document template
+# generated by the following rule
+#
+readme.txt.in: README.in NEWS.in INSTALL.in
rm -f $@
for input in $^; do \
- case $$input in *.in) \
- sed -f gendoc.combined.sed $$input | $(NROFF) >> $@ ;; \
- esac; \
+ sed -f gendoc.combined.sed $$input | $(NROFF) >> $@; \
done
- echo '$$Document: $@ $$: end of file' >> $@
- rm -f gendoc.combined.sed
# Workspace clean-up...
#
maintainer-clean: distclean
rm -f README NEWS INSTALL readme.txt Makefile pkginfo.c
- rm -f *-$(PACKAGE_DISTVERSION)-*.tar.gz *-$(PACKAGE_DISTVERSION)-*.zip
+ rm -f *-$(PACKAGE_DISTVERSION)-*.tar.* *-$(PACKAGE_DISTVERSION)-*.zip
rm -rf ${PACKAGE_DISTROOT} staged ${srcdir}/autom4te.cache
# $RCSfile$: end of file