X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=mk%2Ftarget.mk;h=295ec4cabd01ba39fefc647c1713df0a946cf089;hb=57c3ca2603ef0f2358d8d246bff1dd47ef97e843;hp=aae3cfd6b0beaa00b805862315c10a023d470b30;hpb=6b2a8b5de70f9ecf676037e5b0617172be308e6d;p=ghc-hetmet.git diff --git a/mk/target.mk b/mk/target.mk index aae3cfd..295ec4c 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -32,46 +32,6 @@ # # -################################################################## -# FPtools standard targets -# -# depend: -# -# The depend target has to cope with a set of files that may have -# different ways of computing their dependencies, i.e., a Haskell -# module's dependencies are computed differently from C files. -# -.PHONY: depend - -# Compiler produced files that are targets of the source's imports. -MKDEPENDHS_OBJ_SUFFICES=o - -DEPEND_SRCS = $(MKDEPENDHS_SRCS) $(MKDEPENDC_SRCS) - -ifneq "$(DEPEND_SRCS)" "" -depend :: .depend - -# Build .depend, then recursively invoke $(MAKE) to carry on. Because the -# build system includes .depend (from boilerplate.mk), GNU make records .depend -# as a Makefile and automatically tries to rebuild it if it is out-of-date. -# this will happen before any other targets are processed. -.depend : $(DEPEND_SRCS) - @echo "------------------------------------------------------------------------" - @echo "===fptools== Rebuilding dependencies..." - @echo "PWD = $(shell pwd)" - @echo "------------------------------------------------------------------------" - @$(RM) .depend - @touch .depend -ifneq "$(MKDEPENDC_SRCS)" "" - $(MKDEPENDC) -f .depend $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(MKDEPENDC_SRCS) -endif -ifneq "$(MKDEPENDHS_SRCS)" "" - $(MKDEPENDHS) -M -optdep-f -optdep.depend $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(MKDEPENDHS_OPTS) $(HC_OPTS) $(MKDEPENDHS_SRCS) -endif - -else # no dependencies required -depend :: -endif ################################################################## # @@ -158,6 +118,48 @@ $(SUBDIRS) :: endif ################################################################## +# FPtools standard targets +# +# depend: +# +# The depend target has to cope with a set of files that may have +# different ways of computing their dependencies, i.e., a Haskell +# module's dependencies are computed differently from C files. +# +# Note that we don't compute dependencies automatically, i.e., have the +# .depend file be a target that is dependent on the Haskell+C sources, +# and then have the `depend' target depend on `.depend'. The reason for +# this is that when GNU make is processing the `include .depend' statement +# it records .depend as being a Makefile. Before doing any other processing, +# `make' will try to check to see if the Makefiles are up-to-date. And, +# surprisingly enough, .depend has a rule for it, so if any of the source +# files change, it will be invoked, *regardless* of what target you're making. +# +# So, for now, the dependencies has to be re-computed manually via `make depend' +# whenever a module changes its set of imports. Doing what was outlined above +# is only a small optimisation anyway, it would avoid the recomputation of +# dependencies if the .depend file was newer than any of the source modules. +# +.PHONY: depend + +# Compiler produced files that are targets of the source's imports. +MKDEPENDHS_OBJ_SUFFICES=o + +depend :: $(MKDEPENDHS_SRCS) $(MKDEPENDC_SRCS) + @$(RM) .depend + @touch .depend +ifneq "$(DOC_SRCS)" "" + $(MKDEPENDLIT) -o .depend $(MKDEPENDLIT_OPTS) $(filter %.lit,$(DOC_SRCS)) +endif +ifneq "$(MKDEPENDC_SRCS)" "" + $(MKDEPENDC) -f .depend $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(MKDEPENDC_SRCS) +endif +ifneq "$(MKDEPENDHS_SRCS)" "" + $(MKDEPENDHS) -M -optdep-f -optdep.depend $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(MKDEPENDHS_OPTS) $(HC_OPTS) $(MKDEPENDHS_SRCS) +endif + + +################################################################## # boot # # The boot target, at a minimum generates dependency information @@ -291,8 +293,19 @@ boot :: depend ifneq "$(HS_PROG)" "" all :: $(HS_PROG) +ifneq "$(BootingFromHc)" "YES" +$(HS_PROG) :: $(HS_OBJS) + $(HC) -o $@ $(HC_OPTS) $(LD_OPTS) $(HS_OBJS) +else +# see bootstrp.mk $(HS_PROG) :: $(HS_OBJS) - $(HC) -o $@ $(HC_OPTS) $(LD_OPTS) $(HS_OBJS) $(LIBS) + $(CC) -o $@ $(HC_BOOT_CC_OPTS) $(HC_BOOT_LD_OPTS) $(HS_OBJS) $(HC_BOOT_LIBS) +endif +endif + +# Object and interface files have suffixes tagged with their ways +ifneq "$(way)" "" +SRC_HC_OPTS += -hisuf $(way_)hi -hcsuf $(way_)hc -osuf $(way_)o endif #---------------------------------------- @@ -307,29 +320,39 @@ endif #---------------------------------------- -# Libraries/archives +# Building HsLibs libraries. + +ifneq "$(HSLIB)" "" ifeq "$(IS_CBITS_LIB)" "YES" _cbits := _cbits endif -ifneq "$(HSLIB)" "" LIBRARY = libHS$(HSLIB)$(_cbits)$(_way).a GHCI_LIBRARY = HS$(HSLIB)$(_cbits)$(_way).o + +ifneq "$(IS_CBITS_LIB)" "YES" +WAYS=$(GhcLibWays) +endif + ifeq "$(LIBOBJS)" "" - ifneq "$(IS_CBITS_LIB)" "YES" - LIBOBJS = $(HS_OBJS) - else + ifeq "$(IS_CBITS_LIB)" "YES" LIBOBJS = $(C_OBJS) + else + LIBOBJS = $(HS_OBJS) endif endif -ifneq "$(IS_CBITS_LIB)" "" -CC = $(HC) + +ifeq "$(IS_CBITS_LIB)" "YES" override datadir:=$(libdir)/includes INSTALL_DATAS += Hs$(shell perl -e 'print ucfirst "$(HSLIB)"').h SRC_CC_OPTS += -I$(GHC_INCLUDE_DIR) -I$(GHC_RUNTIME_DIR) endif -endif + +endif # HSLIB + +#---------------------------------------- +# Libraries/archives ifneq "$(LIBRARY)" "" all :: $(LIBRARY) @@ -605,12 +628,6 @@ endif all :: $(SCRIPT_PROG) -# -# #! support under cygwin32 is not quite there yet, -# so we rely on the eval `trick' instead. On all other -# platforms, we prepend #!$(INTERP) -- SOF 6/97 -# - $(SCRIPT_PROG) : $(SCRIPT_OBJS) $(RM) $@ @echo Creating $@... @@ -684,6 +701,7 @@ $(LINK) : $(LINK_TARGET) # install links to script drivers. # install :: + @$(INSTALL_DIR) $(bindir) @if ( $(PERL) -e '$$fn="$(bindir)/$(LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \ echo "Creating a symbol link from $(LINK_TARGET) to $(LINK) in $(bindir)"; \ $(RM) $(bindir)/$(LINK); \ @@ -748,11 +766,8 @@ ifneq "$(LIBRARY)" "" INSTALL_LIBS += $(LIBRARY) ifeq "$(DLLized)" "YES" INSTALL_PROGS += $(DLL_NAME) -else -ifeq "$(DLLized)" "YES" INSTALL_LIBS += $(patsubst %.a,%_imp.a, $(LIBRARY)) endif -endif INSTALL_DATAS += $(HS_IFACES) endif @@ -961,7 +976,7 @@ SGML_HTML = $(addsuffix .html,$(SGML_DOC)) # HTML output goes in a subdirectory on its own. SGML_TEXT = $(addsuffix .txt,$(SGML_DOC)) -$(SGML_DVI) $(SGML_PS) $(SGML_HTML) $(SGML_TEXT) :: $(SGML_SRCS) +$(SGML_DVI) $(SGML_PS) $(SGML_HTML) $(SGML_TEXT) $(SGML_PDF) :: $(SGML_SRCS) dvi :: $(SGML_DVI) ps :: $(SGML_PS)