X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=mk%2Ftarget.mk;h=dd2ddcbd2a9b482eced21ad7873d32e1c088ea5d;hb=ec2e177faf6ed8ff934f0bd97cf77fcb0f2210bd;hp=6eabebf077ec953022d3a98414f0edc3030af0e2;hpb=97e3db0367d36f7b28ddb2e75df4eba41a415a26;p=ghc-hetmet.git diff --git a/mk/target.mk b/mk/target.mk index 6eabebf..dd2ddcb 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -301,19 +301,8 @@ else $(HS_PROG) :: $(HS_OBJS) $(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 -# add syslib dependencies and current package name -SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS)) -ifneq "$(PACKAGE)" "" -SRC_HC_OPTS += -package-name $(PACKAGE) -else -# No library, we are actually building the tools +# for building a Haskell program, we add FptoolsHcOpts SRC_HC_OPTS += $(FptoolsHcOpts) endif @@ -347,17 +336,26 @@ endif ifneq "$(PACKAGE)" "" +# add syslib dependencies and current package name +SRC_HC_OPTS += -package-name $(PACKAGE) +SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS)) + ifeq "$(IS_CBITS_LIB)" "YES" _cbits := _cbits STUBOBJS += $(HSC_C_OBJS) # Add _hsc.c files to the cbits library -SRCS += $(wildcard ../*_hsc.c) +C_SRCS += $(wildcard ../*_hsc.c) # Make .hsc.h include files from the directory above visible -SRC_CC_OPTS += -I.. +# (and the cbits/ library too). +SRC_CC_OPTS += -I.. -I. endif +ifneq "$(way)" "i" LIBRARY = libHS$(PACKAGE)$(_cbits)$(_way).a GHCI_LIBRARY = HS$(PACKAGE)$(_cbits)$(_way).o +else +LIBRARY = $(PACKAGE).dll +endif ifneq "$(IS_CBITS_LIB)" "YES" WAYS=$(GhcLibWays) @@ -371,8 +369,6 @@ ifeq "$(LIBOBJS)" "" endif endif -SRC_CC_OPTS += -I$(GHC_INCLUDE_DIR) -I$(GHC_RUNTIME_DIR) - ifeq "$(IS_CBITS_LIB)" "YES" override datadir:=$(libdir)/include INSTALL_DATAS += Hs$(shell perl -e 'print ucfirst "$(PACKAGE)"').h @@ -385,7 +381,7 @@ endif # PACKAGE #---------------------------------------- # Libraries/archives # -# Build $(LIBRARY) from $(LIBOJBS)+$(STUBOBJS) +# Build $(LIBRARY) from $(LIBOBJS)+$(STUBOBJS) # # Inputs: # $(LIBOBJS) @@ -397,11 +393,18 @@ endif # PACKAGE ifneq "$(LIBRARY)" "" all :: $(LIBRARY) +ifneq "$(way)" "i" define BUILD_LIB $(RM) $@ $(AR) $(AR_OPTS) $@ $(STUBOBJS) $(LIBOBJS) $(RANLIB) $@ endef +else +define BUILD_LIB +$(RM) $@ +al -out:$@ $(STUBOBJS) $(LIBOBJS) +endef +endif # # For Haskell object files, we might have chosen to split @@ -418,11 +421,22 @@ ifneq "$(way)" "u" SRC_HC_OPTS += -split-objs +ifeq "$(ArSupportsInput)" "" define BUILD_LIB $(RM) $@ (echo $(STUBOBJS); $(FIND) $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o') | xargs ar q $@ $(RANLIB) $@ endef +else +define BUILD_LIB +$(RM) $@ +echo $(STUBOBJS) > $@.list +$(FIND) $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o' >> $@.list +$(AR) $(AR_OPTS) $@ $(ArSupportsInput) $@.list +$(RM) $@.list +$(RANLIB) $@ +endef +endif # Extra stuff for compiling Haskell files with $(SplitObjs): @@ -501,21 +515,18 @@ CLEAN_FILES += $(GHCI_LIBRARY) all :: $(GHCI_LIBRARY) -ifneq "$(GHCI_LIBRARY)" "HSstd.o" -# An annoying gotcha is that the Prelude is a bit special, -# for reasons described in ghc/lib/std/Makefile. -# So we only put in this standard rule for packages other than std -# The rule for the Prelude is in ghc/lib/std/Makefile -# We check for GHCI_LIBRARY being HSstd.o rather than -# PACKAGE being std, because we want to still use the boilerplate rule -# for cbits. +ifneq "$(DONT_WANT_STD_GHCI_LIB_RULE)" "YES" +# If you don't want to build GHCI_LIBRARY the 'standard' way, +# set DONT_WANT_STD_GHCI_LIB_RULE to YES. The Prelude and +# hslibs/Win32 uses this 'feature'. +# $(GHCI_LIBRARY) :: $(LIBOBJS) ld -r -x -o $@ $(LIBOBJS) $(STUBOBJS) -endif +endif # DONT_WANT_STD_GHCI_LIB_RULE endif # GhcWithInterpreter endif # way -endif # GHCI_LIBRARY +endif # GHCI_LIBRARY != "" #---------------------------------------- @@ -976,11 +987,11 @@ install-strip:: @$(MAKE) EXTRA_INSTALL_OPTS='-s' install endif -########################################### +############################################################################## # # Targets: check tags show # -########################################### +############################################################################## #------------------------------------------------------------ # Check @@ -1018,11 +1029,14 @@ endif # show: - @echo '$(VALUE)=$($(VALUE))' + @echo '$(VALUE)="$($(VALUE))"' -#-------------------------------------------------------------------------- -# SGML Documentation +################################################################################ +# +# SGML Documentation # +################################################################################ + .PHONY: dvi ps html pdf rtf ifneq "$(SGML_DOC)" "" @@ -1061,11 +1075,11 @@ extraclean :: $(RM) -rf $(SGML_DOC) endif -########################################### +############################################################################## # # Targets: clean # -########################################### +############################################################################## # we have to be careful about recursion here; since all the clean # targets are recursive, we don't want to make eg. distclean depend on @@ -1090,11 +1104,11 @@ maintainer-clean:: extraclean @echo 'deletes files that may need special tools to rebuild.' rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES) $(DIST_CLEAN_FILES) $(MAINTAINER_CLEAN_FILES) -################################################################################# +################################################################################ # # Way management # -################################################################################# +################################################################################ # Here is the ingenious jiggery pokery that allows you to build multiple versions # of a program in a single build tree. @@ -1149,6 +1163,16 @@ $(LIB_WAY_TARGETS) : endif # if way +# ------------------------------------------------------------------------- +# 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 + +# ------------------------------------------------------------------------- +# Rules to invoke the current target recursively for each way + ifneq "$(WAYS)" "" ifeq "$(way)" ""