X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=mk%2Ftarget.mk;h=5becd563c9f4b1a6e36910351ae99969221ce0ad;hb=fbf2e16821d9661d4a086ddb4eaaf31b97f17740;hp=8117ba67af0236fbee604950b947cf11f4dae8d1;hpb=5938c4ea2bce8abd3ebcc32ca262c81d10461930;p=ghc-hetmet.git diff --git a/mk/target.mk b/mk/target.mk index 8117ba6..5becd56 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -374,7 +374,11 @@ ifneq "$(SCRIPT_PROG)" "" # # ToDo: make this work for shell scripts (drop the initial $). # +ifeq "$(INTERP)" "$(SHELL)" +SCRIPT_SUBST=$(foreach val,$(SCRIPT_SUBST_VARS),"echo \"$(val)=\\\"$($(val))\\\";\" >> $@;") +else SCRIPT_SUBST=$(foreach val,$(SCRIPT_SUBST_VARS),"echo \"$$\"\"$(val)=\\\"$($(val))\\\";\" >> $@;") +endif all :: $(SCRIPT_PROG) @@ -475,10 +479,10 @@ ifneq "$(BIN_DIST)" "1" @for i in $(INSTALL_SCRIPTS); do \ $(RM) $$i.tmp; \ echo "#! $(PERL)" > $$i.tmp ; \ - echo $$"bindir='$(bindir)';" >> $$i.tmp ; \ - echo $$"libdir='$(libdir)';" >> $$i.tmp ; \ - echo $$"libexecdir='$(libexecdir)';" >> $$i.tmp ; \ - echo $$"datadir='$(datadir)';" >> $$i.tmp ; \ + echo '$$'"bindir='$(bindir)';" >> $$i.tmp ; \ + echo '$$'"libdir='$(libdir)';" >> $$i.tmp ; \ + echo '$$'"libexecdir='$(libexecdir)';" >> $$i.tmp ; \ + echo '$$'"datadir='$(datadir)';" >> $$i.tmp ; \ cat $$i >> $$i.tmp ; \ echo $(INSTALL_PROGRAM) $(filter-out -s,$(INSTALL_OPTS)) $$i.tmp $(bindir)/$$i ; \ $(INSTALL_PROGRAM) $(filter-out -s,$(INSTALL_BIN_OPTS)) $$i.tmp $(bindir)/$$i ; \ @@ -504,10 +508,10 @@ ifneq "$(BIN_DIST)" "1" @for i in $(INSTALL_LIB_SCRIPTS); do \ $(RM) $$i.tmp; \ echo "#! $(PERL)" > $$i.tmp ; \ - echo $$"bindir='$(bindir)';" >> $$i.tmp ; \ - echo $$"libdir='$(libdir)';" >> $$i.tmp ; \ - echo $$"libexecdir='$(libexecdir)';" >> $$i.tmp ; \ - echo $$"datadir='$(datadir)';" >> $$i.tmp ; \ + echo '$$'"bindir='$(bindir)';" >> $$i.tmp ; \ + echo '$$'"libdir='$(libdir)';" >> $$i.tmp ; \ + echo '$$'"libexecdir='$(libexecdir)';" >> $$i.tmp ; \ + echo '$$'"datadir='$(datadir)';" >> $$i.tmp ; \ cat $$i >> $$i.tmp ; \ echo $(INSTALL_PROGRAM) $(INSTALL_OPTS) $$i $(libdir) ; \ $(INSTALL_PROGRAM) $(INSTALL_OPTS) $$i.tmp $(libdir)/$$i ; \ @@ -533,10 +537,10 @@ ifneq "$(BIN_DIST)" "1" @for i in $(INSTALL_LIBEXEC_SCRIPTS); do \ $(RM) $$i.tmp; \ echo "#! $(PERL)" > $$i.tmp ; \ - echo $$"bindir='$(bindir)';" >> $$i.tmp ; \ - echo $$"libdir='$(libdir)';" >> $$i.tmp ; \ - echo $$"libexecdir='$(libexecdir)';" >> $$i.tmp ; \ - echo $$"datadir='$(datadir)';" >> $$i.tmp ; \ + echo '$$'"bindir='$(bindir)';" >> $$i.tmp ; \ + echo '$$'"libdir='$(libdir)';" >> $$i.tmp ; \ + echo '$$'"libexecdir='$(libexecdir)';" >> $$i.tmp ; \ + echo '$$'"datadir='$(datadir)';" >> $$i.tmp ; \ cat $$i >> $$i.tmp ; \ echo $(INSTALL_PROGRAM) $(INSTALL_OPTS) $$i $(libexecdir) ; \ $(INSTALL_PROGRAM) $(INSTALL_OPTS) $$i.tmp $(libexecdir)/$$i ; \ @@ -672,7 +676,7 @@ dist-pre:: -rm -rf $(SRC_DIST_DIR) -rm -f $(SRC_DIST_NAME).tar.gz (cd $(FPTOOLS_TOP_ABS); find $(SRC_DIST_DIRS) -type d \( -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -exec $(MKDIRHIER) $(SRC_DIST_DIR)/{} \; \) ; ) - (cd $(FPTOOLS_TOP_ABS); find $(SRC_DIST_DIRS) -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -name "*~" -prune -o -name ".cvsignore" -prune -o -type l -exec $(LN_S) $(FPTOOLS_TOP_ABS)/{} $(SRC_DIST_DIR)/{} \; ) + (cd $(FPTOOLS_TOP_ABS); find $(SRC_DIST_DIRS) -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -name "*~" -prune -o -name ".cvsignore" -prune -o -name "\#*" -prune -o -name ".\#*" -prune -o -type l -exec $(LN_S) $(FPTOOLS_TOP_ABS)/{} $(SRC_DIST_DIR)/{} \; ) # # After having created a shadow distribution tree and copied/linked @@ -723,27 +727,27 @@ binary-dist-pre:: -rm -rf $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) -rm -f $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME).tar.gz @for i in $(BIN_DIST_DIRS); do \ - if (test -d "$$i"); then \ - echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i-$(ProjectVersion); \ - $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i-$(ProjectVersion); \ - echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion); \ - $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion); \ - echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$$i-$(ProjectVersion); \ - $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$$i-$(ProjectVersion); \ + if test -d "$$i"; then \ + echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion); \ + $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion); \ + echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion); \ + $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion); \ + echo $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$(ProjectNameShort)-$(ProjectVersion); \ + $(MKDIRHIER) $(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$(ProjectNameShort)-$(ProjectVersion); \ echo $(MAKE) -C $$i $(MFLAGS) install BIN_DIST=1 BIN_DIST_NAME=$(BIN_DIST_NAME) \ prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \ exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \ - bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \ - libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \ - libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \ - datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$$i-$(ProjectVersion) ; \ + bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \ + libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \ + libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \ + datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$(ProjectNameShort)-$(ProjectVersion) ; \ $(MAKE) -C $$i $(MFLAGS) install BIN_DIST=1 BIN_DIST_NAME=$(BIN_DIST_NAME) \ prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \ exec_prefix=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME) \ - bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \ - libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \ - libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$$i-$(ProjectVersion) \ - datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$$i-$(ProjectVersion) ; \ + bindir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/bin/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \ + libdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \ + libexecdir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/lib/$(TARGETPLATFORM)/$(ProjectNameShort)-$(ProjectVersion) \ + datadir=$(BIN_DIST_TMPDIR)/$(BIN_DIST_NAME)/share/$(ProjectNameShort)-$(ProjectVersion) ; \ fi; \ done @@ -865,6 +869,30 @@ else cp $(TEXI2HTML_PREFIX)invisible.xbm html/ @touch $@ endif + +#-------------------------------------------------------------------------- +# SGML Documentation +# +# This will eventually replace the literate stuff for documentation + +SGML_SRCS = $(wildcard *.sgml *.vsgml) +SGML_DVI = $(addsuffix .dvi, $(basename $(SGML_SRCS))) +SGML_PS = $(addsuffix .ps, $(basename $(SGML_SRCS))) +SGML_TEXI = $(addsuffix .texi, $(basename $(SGML_SRCS))) +SGML_INFO = $(addsuffix .info, $(basename $(SGML_SRCS))) +SGML_HTML = $(addsuffix .html, $(basename $(SGML_SRCS))) +SGML_TEXT = $(addsuffix .txt, $(basename $(SGML_SRCS))) + +dvi :: $(SGML_DVI) +info :: $(SGML_INFO) +html :: $(SGML_HTML) +txt :: $(SGML_TXT) +ps :: $(SGML_PS) + +CLEAN_FILES += $(SGML_TEXT) $(SGML_HTML) $(SGML_TEXI) $(SGML_PS) $(SGML_DVI) + +# suffix rules should handle the rest (for single-file docs at least). + ########################################### # # Targets: clean @@ -911,7 +939,7 @@ ifneq "$(HS_OBJS)" "" ifneq "$(filter -split-objs,$(HC_OPTS))" "" clean :: find $(patsubst %.$(way_)o,%,$(HS_OBJS)) -name '*.$(way_)o' -print | xargs $(RM) __rm_food - rmdir $(patsubst %.$(way_)o,%,$(HS_OBJS)) + -rmdir $(patsubst %.$(way_)o,%,$(HS_OBJS)) endif endif @@ -1000,6 +1028,18 @@ endif # if way # No ways, so iterate over the SUBDIRS +# note about recursively invoking make: we'd like make to drop all the +# way back to the top level if it fails in any of the +# sub(sub-...)directories. This is done by setting the -e flag to the +# shell during the loop, which causes an immediate failure if any of +# the shell commands fail. + +# One exception: if the user gave the -i or -k flag to make in the +# first place, we'd like to reverse this behaviour. So we check for +# these flags, and set the -e flag appropriately. NOTE: watch out for +# the --no-print-directory flag which is passed to recursive +# invocations of make. + ifeq "$(way)" "" ifneq "$(SUBDIRS)" "" @@ -1008,10 +1048,10 @@ all docs runtests boot TAGS clean veryclean maintainer-clean install info :: @echo "===fptools== Recursively making \`$@' in $(SUBDIRS) ..." @echo "PWD = $(shell pwd)" @echo "------------------------------------------------------------------------" - @case '${MFLAGS}' in -*[ik]*) set -e;; *) set +e;; esac - @for i in $(SUBDIRS) ; do \ + @case '${MFLAGS}' in *-[ik]*) set +e;; *-r*[ik]*) set +e;; *) set -e;; esac; \ + for i in $(SUBDIRS) ; do \ echo "------------------------------------------------------------------------"; \ - echo "==fptools== $(MAKE) $@;"; \ + echo "==fptools== $(MAKE) $@ $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ echo "------------------------------------------------------------------------"; \ $(MAKE) --no-print-directory -C $$i $(MFLAGS) $@; \ @@ -1022,7 +1062,7 @@ all docs runtests boot TAGS clean veryclean maintainer-clean install info :: @echo "------------------------------------------------------------------------" dist :: - @case '${MFLAGS}' in -*[ik]*) set -e;; *) set +e;; esac + @case '${MFLAGS}' in *-[ik]*) set +e;; *-r*[ik]*) set +e;; *) set -e;; esac; \ for i in $(SUBDIRS) ; do \ $(MKDIRHIER_PREFIX)mkdirhier $(SRC_DIST_DIR)/$$i; \ $(MAKE) -C $$i $(MFLAGS) $@ SRC_DIST_DIR=$(SRC_DIST_DIR)/$$i; \ @@ -1050,8 +1090,8 @@ all docs runtests TAGS clean veryclean maintainer-clean install :: @echo "===fptools== Recursively making \`$@' for ways: $(WAYS) ..." @echo "PWD = $(shell pwd)" @echo "------------------------------------------------------------------------" - @case '${MFLAGS}' in -*[ik]*) set -e;; *) set +e;; esac - @for i in $(WAYS) ; do \ + @case '${MFLAGS}' in *-[ik]*) set +e;; *-r*[ik]*) set +e;; *) set -e;; esac; \ + for i in $(WAYS) ; do \ echo "------------------------------------------------------------------------"; \ echo "==fptools== $(MAKE) way=$$i $@;"; \ echo "PWD = $(shell pwd)"; \