[project @ 1998-05-29 14:02:29 by sof]
[ghc-hetmet.git] / mk / target.mk
index f0cccef..fe44cae 100644 (file)
@@ -324,6 +324,23 @@ endef
 endif # $(filter...
 endif
 
+#
+# Remove local symbols from library objects if requested.
+#
+
+ifeq "$(StripLibraries)" "YES"
+ifneq "$(filter -split-objs,$(HC_OPTS))" ""
+SRC_HC_POST_OPTS += \
+  for i in $(basename $@)/*; do \
+       ld -r -x -o $$i.tmp $$i; \
+       $(MV) $$i.tmp $$i; \
+  done
+else
+SRC_HC_POST_OPTS += \
+  ld -r -x -o $@.tmp $@; $(MV) $@.tmp $@
+endif
+endif
+
 $(LIBRARY) :: $(LIBOBJS)
        $(BUILD_LIB)
 endif
@@ -413,10 +430,14 @@ endif
 ifneq "$(SCRIPT_LINK)" ""
 all :: $(SCRIPT_LINK)
 
-# The use of -L is non-standard, but I've yet to find
-# an implementation of `test' that doesn't like it.
+#
+# Don't want to overwrite $(SCRIPT_LINK)s that aren't symbolic
+# links. Testing for symbol links is problematic to do in
+# a portable fashion using a /bin/sh test, so we simply rely
+# on perl.
+#
 $(SCRIPT_LINK) : $(SCRIPT_PROG)
-       @if ( test ! -f $(SCRIPT_LINK) -o -L $(SCRIPT_LINK) ); then \
+       @if ( perl -e '$$fn="$(SCRIPT_LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
           echo "Creating a symbol link from $(SCRIPT_PROG) to $(SCRIPT_LINK)"; \
           $(RM) $(SCRIPT_LINK); \
           $(LN_S) $(SCRIPT_PROG) $(SCRIPT_LINK); \
@@ -477,8 +498,9 @@ install-dirs ::
 ifneq "$(INSTALL_PROGS)" ""
 install:: $(INSTALL_PROGS)
        @$(INSTALL_DIR) $(bindir)
-       for i in $(INSTALL_PROGS); do \
-               $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i$(exeext) $(bindir); \
+       @for i in $(INSTALL_PROGS); do \
+               echo $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i$(exeext) $(bindir); \
+               $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i$(exeext) $(bindir);      \
        done
 endif
 
@@ -607,30 +629,30 @@ endif
 # Use with care..
 #
 uninstall:: 
-ifeq ($(INSTALL_PROGS),)
-       @for i in $(INSTALL_PROGS) ; do                         \
+       @for i in $(INSTALL_PROGS) "" ; do                      \
+         if test "$$i"; then                                   \
                echo rm -f $(bindir)/`basename $$i`;            \
                rm -f $(bindir)/`basename $$i`;                 \
+         fi;                                                   \
        done
-endif
-ifeq ($(INSTALL_LIBS),)
-       @for i in $(INSTALL_LIBS); do                           \
+       @for i in $(INSTALL_LIBS) ""; do                        \
+         if test "$$i"; then                                   \
                echo rm -f $(libdir)/`basename $$i`;            \
                rm -f $(libdir)/`basename $$i`;                 \
+         fi;                                                   \
        done
-endif
-ifeq ($(INSTALL_LIBEXECS),)
-       @for i in $(INSTALL_LIBEXECS); do                       \
+       @for i in $(INSTALL_LIBEXECS) ""; do                    \
+         if test "$$i"; then                                   \
                echo rm -f $(libexecdir)/`basename $$i`;        \
                rm -f $(libexecdir)/`basename $$i`;             \
+         fi;                                                   \
        done
-endif
-ifeq ($(INSTALL_DATAS),)
-       @for i in $(INSTALL_DATAS); do                          \
+       @for i in $(INSTALL_DATAS) ""; do                       \
+         if test "$$i"; then                                   \
                echo rm -f $(datadir)/`basename $$i`;           \
                rm -f $(datadir)/`basename $$i`;                \
+         fi;                                                   \
        done
-endif
 
 #
 # install-strip is from the GNU Makefile standard.
@@ -719,9 +741,14 @@ dist-post::
 dist-manifest ::
        cd $(SRC_DIST_DIR); find . \( -type l -o -type f \) -exec ls -lLG {} \; | sed -e 's/\.\///' > /tmp/MANIFEST ; mv /tmp/MANIFEST MANIFEST
 
-dist-package::
+dist-package:: dist-package-tar-gz
+
+dist-package-tar-gz ::
        cd $(SRC_DIST_DIR); cd ..; $(TAR) chzf $(SRC_DIST_NAME).tar.gz $(SRC_DIST_NAME)
 
+dist-package-zip ::
+       cd $(SRC_DIST_DIR); cd ..; $(ZIP) -r $(SRC_DIST_NAME).zip $(SRC_DIST_NAME)
+
 #
 # binary-dist creates a binary bundle, set BIN_DIST_NAME
 # to package name and do `make binary-dist' (normally this