OSDN Git Service

Don't attempt to resolve dependencies for unidentified packages.
[mingw/mingw-get.git] / Makefile.in
index 5b2209f..70cd6f3 100644 (file)
@@ -30,14 +30,14 @@ PACKAGE_SUBSYSTEM = @host_os@
 CLI_RELEASE_CLASS = @CLI_RELEASE_CLASS@
 GUI_RELEASE_CLASS = @GUI_RELEASE_CLASS@
 
-BUILD_TAG = `>> build.tag; cat build.tag`
+BUILD_TAG = `test -f build.tag && cat build.tag`
 DEBUGLEVEL = @DEBUGLEVEL@
 
 # Establish the appropriate mechanism for invoking 'make' recursively,
 # WITHOUT incurring the noise of its "Entering directory..." messages.
 #
-@SET_MAKE@
 QUIET_MAKE = $(MAKE)@NO_PRINT_DIRECTORY@
+@SET_MAKE@
 
 # Establish source code directory organisation, and set reference
 # paths for access to source files.
@@ -116,32 +116,34 @@ AWK_PRINT_LINE_BUFFER = print linebuf;
 
 # Identify an appropriate resource compiler, for GUI builds,
 # and define a set of script macros to propagate the build-time
-# specific package meta-data into the compile resource modules.
+# specific package meta-data into compiled resource modules.
 #
 RC = @RC@
-RC_SCRIPT = tag=$(BUILD_TAG); \
-  test "x$$tag" != x && tag="-$(GUI_RELEASE_CLASS)-$$tag"; \
+RC_SCRIPT = tag_class=$(GUI_RELEASE_CLASS) \
     $(TAG_SCRIPT)
 
-VERSION_SCRIPT = tag=$(BUILD_TAG); \
-  test "x$$tag" != x && tag="-$(CLI_RELEASE_CLASS)-$$tag"; \
+VERSION_SCRIPT = tag_class=$(CLI_RELEASE_CLASS) \
     $(TAG_SCRIPT)
 
-TAG_SCRIPT = sed \
-  -e "s!%PACKAGE_NAME%!$(PACKAGE_TARNAME)!g" \
-  -e "s!%PACKAGE_VERSION%!$(PACKAGE_VERSION)$$tag!g" \
-  -e "s!%PACKAGE_VERINFO_PRODUCT_VERSION%!`$(PACKAGE_VERINFO_SCRIPT)`!g" \
-  -e "s!%COPYRIGHT_HOLDER%!@COPYRIGHT_HOLDER@!g" \
-  -e "s!%YEARS_OF_ISSUE%!@YEARS_OF_ISSUE@!g"
+TAG_SCRIPT = tag=$(BUILD_TAG); \
+  test "x$$tag_class" != x && test "x$$tag" != x && tag="$$tag_class-$$tag"; \
+  test "x$$tag" != x && tag="-$$tag"; \
+  sed  \
+    -e "s!%PACKAGE_NAME%!$(PACKAGE_TARNAME)!g" \
+    -e "s!%PACKAGE_VERSION%!$(PACKAGE_VERSION)$$tag!g" \
+    -e "s!%PACKAGE_VERINFO_PRODUCT_VERSION%!`$(PACKAGE_VERINFO_SCRIPT)`!g" \
+    -e "s!%PACKAGE_BASE_DISTNAME%!$(PACKAGE_DISTNAME)$$tag-%s.$(TAREXT)!g" \
+    -e "s!%PACKAGE_DATA_DISTNAME%!$(SETUP_DISTNAME)$$tag-%s.$(TAREXT)!g" \
+    -e "s!%PACKAGE_DIST_URL%!@PACKAGE_DIST_DOMAIN@/@PACKAGE_DIST_DIR@!g" \
+    -e "s!%COPYRIGHT_HOLDER%!@COPYRIGHT_HOLDER@!g" \
+    -e "s!%YEARS_OF_ISSUE%!@YEARS_OF_ISSUE@!g"
 
 PACKAGE_VERINFO_SCRIPT = \
   echo $(PACKAGE_VERSION) | awk -F. '{ \
     printf "%d, %d, ", $$1, $$2 * 100 + $$3 \
-  }'; \
-  (test -f build.tag && cat build.tag || date +%Y%m%d-0) | awk -F- '{ \
-    printf "%d, %d", (( substr( $$1, 1, 4 ) - 1970 ) * 16 \
-      + substr( $$1, 5, 2 )) * 32 + substr( $$1, 7, 2 ), \
-      $$2 \
+  }'; (test "x$$tag" = x && date +%Y%m%d-0 || echo $$tag) | awk -F- '{ \
+    DF = NF - 1; printf "%d, %d", (( substr( $$DF, 1, 4 ) - 1970 ) * 16 \
+      + substr( $$DF, 5, 2 )) * 32 + substr( $$DF, 7, 2 ), $$NF \
   }'
 
 RC_INCLUDES = -I . -I ${srcdir}/src -I ${srcdir}/icons
@@ -158,36 +160,58 @@ LIBS = -Wl,-Bstatic -llua -lz -lbz2 -llzma -Wl,-Bdynamic -lwininet
 
 # Define the content of package deliverables.
 #
-CORE_DLL_OBJECTS  =  climain.$(OBJEXT) pkgshow.$(OBJEXT) dmhcore.$(OBJEXT) \
+CORE_DLL_OBJECTS  =  \
+   climain.$(OBJEXT) pkgshow.$(OBJEXT) dmhcore.$(OBJEXT) dmhmsgs.$(OBJEXT) \
    pkgbind.$(OBJEXT) pkginet.$(OBJEXT) pkgstrm.$(OBJEXT) pkgname.$(OBJEXT) \
    pkgexec.$(OBJEXT) pkgfind.$(OBJEXT) pkginfo.$(OBJEXT) pkgspec.$(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) tinystr.$(OBJEXT) tinyxmlparser.$(OBJEXT) \
-   mkpath.$(OBJEXT)  tinyxmlerror.$(OBJEXT)
+   apihook.$(OBJEXT) mkpath.$(OBJEXT)  tinyxmlerror.$(OBJEXT)
 
 CLI_EXE_OBJECTS  =   \
    clistub.$(OBJEXT) version.$(OBJEXT) approot.$(OBJEXT) getopt.$(OBJEXT)
 
 GUIMAIN_OBJECTS  =   \
-   guimain.$(OBJEXT) guiexec.$(OBJEXT) dmhguix.$(OBJEXT) \
-   approot.$(OBJEXT) pkgview.$(OBJEXT) pkgtree.$(OBJEXT) pkglist.$(OBJEXT) \
-   pkgdata.$(OBJEXT) pkgnget.$(OBJEXT) guimain.res.$(OBJEXT)
+   guimain.$(OBJEXT) dmhguix.$(OBJEXT) $(GUIMAIN_LIB_OBJECTS) \
+   approot.$(OBJEXT) guimain.res.$(OBJEXT)
+
+GUIMAIN_LIB_OBJECTS = \
+   guiexec.$(OBJEXT) pkgview.$(OBJEXT) pkgtree.$(OBJEXT) pkglist.$(OBJEXT) \
+   pkgdata.$(OBJEXT) pkgnget.$(OBJEXT)
 
 GUIMAIN_LIBS = -lwtklite -lcomctl32
 
+SETUP_TOOL_OBJECTS = setup.$(OBJEXT) setup.res.$(OBJEXT) apihook.$(OBJEXT)
+SETUP_TOOL_LIBS = -lwtklite -lwininet -lcomctl32 -lole32 -Wl,-Bstatic -llzma
+
+SETUP_DLL_OBJECTS =  \
+   dllhook.$(OBJEXT) $(GUIMAIN_LIB_OBJECTS) guimain.res.$(OBJEXT)
+
+SETUP_DLL_LIBS = $(GUIMAIN_LIBS)
+
 script_srcdir = ${srcdir}/scripts/libexec
 
 BIN_PROGRAMS = pkginfo$(EXEEXT) mingw-get$(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
 
+LIBEXEC_SCRIPTS = ${script_srcdir}/setup.lua \
+   ${script_srcdir}/shlink.js ${script_srcdir}/unlink.js
+
 # Primary build goals...
 #
-all: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA)
+all: all-core all-setup
+all-core: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DATA)
+all-setup: all-setup-dll all-setup-exe
+all-setup-dll: mingw-get-setup-0.dll
+
+all-setup-exe:
+       @$(QUIET_MAKE) CXXFLAGS='$(CXXFLAGS) -Os' mingw-get-setup$(EXEEXT)
+
+mingw-get-setup$(EXEEXT): $(SETUP_TOOL_OBJECTS)
+       $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+ $(SETUP_TOOL_LIBS)
 
 pkginfo$(EXEEXT):  driver.$(OBJEXT) pkginfo.$(OBJEXT)
        $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
@@ -207,6 +231,9 @@ lastrites$(EXEEXT): rites.$(OBJEXT)
 mingw-get-0.dll: $(CORE_DLL_OBJECTS)
        $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS)
 
+mingw-get-setup-0.dll: $(SETUP_DLL_OBJECTS) mingw-get-0.dll
+       $(CXX) -shared -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+ $(SETUP_DLL_LIBS)
+
 # The following recursive invocation hook provides a mechanism for
 # accessing make's facility for reporting what it is doing, even when
 # the command to be invoked is encapsulated within a more complex block,
@@ -221,9 +248,26 @@ WITH_REQUEST = $(QUIET_MAKE) COMMAND
 execute-command:
        $(COMMAND)
 
+# Build system configuration management...
+#
+vpath configure @top_srcdir@
+vpath configure.ac @top_srcdir@
+vpath %.m4 @top_srcdir@:@top_srcdir@/build-aux/m4
+vpath Makefile.in @top_srcdir@
+
+Makefile: Makefile.in VERSION.m4 config.status
+       ./config.status
+
+config.status: configure
+       ./config.status --recheck
+
+configure: configure.ac VERSION.m4 aclocal.m4 missing.m4 makeopts.m4
+       cd ${abs_top_srcdir}; autoconf
+
 # Compilation and dependency tracking...
 #
-DEPFLAGS = -MM -MP -MD
+DEPFLAGS = -MMD -MP
+RC_DEPFLAGS = -MM -MP -MD -MF $*.res.x
 sinclude *.d
 
 %.c: %.l
@@ -235,38 +279,34 @@ sinclude *.d
          || $(WITH_REQUEST)='rm -f $(LEX_OUTPUT)' execute-command
 
 %.$(OBJEXT): %.c
-       $(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
-       $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
+       $(CC) $(DEPFLAGS) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
 
 %.$(OBJEXT): %.cpp
-       $(CXX) $(DEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $<
-       $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
+       $(CXX) $(DEPFLAGS) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
 
 %.res.$(OBJEXT): %.rc
-       test ! -f $*.d || mv $*.d $*.d.bak
-       $(CC) $(DEPFLAGS) $(RC_INCLUDES) -DRC_INVOKED -xc-header $<
-       sed 's,$*\.$(OBJEXT):,$@:,' $*.d > $*.res.d; rm -f $*.d
+       $(CC) $(RC_DEPFLAGS) $(RC_INCLUDES) -DRC_INVOKED -xc-header $<
+       sed 's,$*\.$(OBJEXT):,$@:,' $*.res.x > $*.res.d; rm -f $*.res.x
        $(RC_SCRIPT) $< | $(RC) $(RC_INCLUDES) -o $@
-       test ! -f $*.d.bak || mv $*.d.bak $*.d
 
 %.$(OBJEXT): %.ico
        echo $* ICON $*.ico | $(RC) -I ${srcdir}/icons -o $@
 
-# Release tagging...
+# Release tagging; note that, whereas %.time is nominally updated as
+# a side effect of %.tag, we also must provide an explicit rule which
+# will update it directly.  This ensures that we may INDIRECTLY force
+# a dependency on the TIME when %.tag is updated, WITHOUT creating an
+# explicit dependency on %.tag itself.
 #
 time-stamp:
-%.tagged.time: time-stamp
-       > $*.time
-
-%.time:
-       > $*.time
-
-%.tag: %.tagged.time
+%.time:; > $@
+%.tag: time-stamp
        >> $@; tag=`date +%Y%m%d`; \
          tag=`awk -F- -v today=$$tag ' \
            BEGIN { tag = 1 } $$1 == today { tag += $$2 } \
            END { print today "-" tag }' $@`; \
          echo $$tag > $@
+       > $*.time
 
 %.c: %.c.in
        $(VERSION_SCRIPT) $< > $@
@@ -276,7 +316,7 @@ time-stamp:
 
 # The following dependencies must be explicitly declared.
 #
-guimain.res.$(OBJEXT): Makefile build.time verinfo.h
+guimain.res.$(OBJEXT) setup.res.$(OBJEXT): Makefile build.time verinfo.h
 verinfo.h version.c: Makefile build.time
 
 # Installation tools and directory paths...
@@ -346,7 +386,8 @@ SRCDIST_SUBDIRS = src src/pkginfo srcdist-doc icons \
 # 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
+BUILD_AUX_FILES = config.guess config.sub install-sh \
+  makeopts.m4 missing.m4
 
 # The names of distributed package archive files incorporate version
 # information, derived from PACKAGE_VERSION; this is decomposed, so that
@@ -365,7 +406,19 @@ PACKAGE_DISTVERSION = `echo $(PACKAGE_VERSION)-$(PACKAGE_SUBSYSTEM) | sed \
   -e 's,-$(PACKAGE_SUBSYSTEM),$(SNAPSHOT)&,'`
 PACKAGE_DISTNAME = $(PACKAGE_TARNAME)-$(PACKAGE_DISTVERSION)
 
-dist: srcdist bindist readme.txt
+SETUP_DISTNAME = $(PACKAGE_TARNAME)-setup-$(PACKAGE_DISTVERSION)
+
+dist: srcdist bindist readme.txt.dist
+
+# Specify where distributable files should be collected; by default,
+# we will simply use the current build directory.
+#
+distdir = @abs_builddir@
+
+# "Install" distributable text files into the distribution directory.
+#
+%.txt.dist: %.txt
+       cmp -s $< ${distdir}/$(<F) 2>/dev/null || $(INSTALL_DATA) $< ${distdir}
 
 # Specify default compression command, and associated file name extension,
 # for creation and identification of packaged tar archives.
@@ -383,32 +436,34 @@ GCMTAG = `>> $(BLDTAG); cat $(BLDTAG) | sed 's,.,-$(GUI_RELEASE_CLASS)-&,'`
 
 bindist: all licdist
        rm -rf staged
+       $(mkinstalldirs) ${distdir}
        $(MAKE) --no-print-directory prefix=`pwd`/staged install-strip
        cd staged; tar chf - bin/pkginfo$(EXEEXT) | $(TARZIP) -c > \
-         ../pkginfo-$(PACKAGE_DISTVERSION)$(SCMTAG)-bin.$(TAREXT)
+         ${distdir}/pkginfo-$(PACKAGE_DISTVERSION)$(SCMTAG)-bin.$(TAREXT)
        rm staged/bin/pkginfo$(EXEEXT)
        cd staged; tar chf - libexec/mingw-get/guimain$(EXEEXT) | \
-         $(TARZIP) -c > ../$(PACKAGE_DISTNAME)$(GCMTAG)-gui.$(TAREXT)
+         $(TARZIP) -c > ${distdir}/$(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 *
+         ${distdir}/$(PACKAGE_DISTNAME)$(SCMTAG)-bin.$(TAREXT)
+       cd staged; zip -r ${distdir}/$(PACKAGE_DISTNAME)$(SCMTAG)-bin.zip *
        rm -rf staged
 
 licdist:
        rm -rf share
-       $(mkinstalldirs) ./share/doc/${PACKAGE_TARNAME}
+       $(mkinstalldirs) ${distdir} ./share/doc/${PACKAGE_TARNAME}
        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) ${CURDIR}/$$file .; \
          done
        tar chf - share | $(TARZIP) -c > \
-         $(PACKAGE_DISTNAME)$(SCMTAG)-lic.$(TAREXT)
+         ${distdir}/$(PACKAGE_DISTNAME)$(SCMTAG)-lic.$(TAREXT)
        rm -rf share
 
 srcdist: srcdist-doc pkginfo.c
-       rm -rf ${PACKAGE_DISTROOT} && mkdir ${PACKAGE_DISTROOT}
+       rm -rf ${PACKAGE_DISTROOT}
+       $(mkinstalldirs) ${distdir} ${PACKAGE_DISTROOT}
        cd ${PACKAGE_DISTROOT}; for file in $(SRCDIST_FILES); do \
          test -f ${abs_top_srcdir}/$$file \
            && $(LN_S) ${abs_top_srcdir}/$$file . \
@@ -434,7 +489,7 @@ srcdist: srcdist-doc pkginfo.c
        cd ${CURDIR}; done
        cd ${PACKAGE_DISTROOT}/src/pkginfo; $(LN_S) ${CURDIR}/pkginfo.c .
        tar chf - ${PACKAGE_DISTROOT} | $(TARZIP) -c > \
-         $(PACKAGE_DISTNAME)$(SCMTAG)-src.$(TAREXT)
+         ${distdir}/$(PACKAGE_DISTNAME)$(SCMTAG)-src.$(TAREXT)
        rm -rf ${PACKAGE_DISTROOT}
 
 # README, INSTALL and NEWS files to be included in the source distribution
@@ -498,11 +553,14 @@ readme.txt.in: README.in NEWS.in INSTALL.in
 
 # Workspace clean-up...
 #
-clean:
+mostlyclean:
        rm -f *.$(OBJEXT) *.d *.dll $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
 
+clean: mostlyclean
+       rm -f version.c verinfo.h
+
 distclean: clean
-       rm -f config.* version.c build.tag build.time
+       rm -f config.* build.tag build.time
 
 maintainer-clean: distclean
        rm -f README NEWS INSTALL readme.txt Makefile pkginfo.c