$(HC) -o $@ $(HC_OPTS) $(LD_OPTS) $(HS_OBJS) $(LIBS)
endif
+# Object and interface files have suffixes tagged with their ways
+ifneq "$(way)" ""
+SRC_HC_OPTS += -hisuf $(way_)hi
+endif
+
#----------------------------------------
# C programs
ifneq "$(C_PROG)" ""
all :: $(C_PROG)
+ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
+CC_OPTS += -mno-cygwin
+endif
+
$(C_PROG) :: $(C_OBJS)
$(CC) -o $@ $(CC_OPTS) $(LD_OPTS) $(C_OBJS) $(LIBS)
endif
#
ifneq "$(GHCI_LIBRARY)" ""
+ifeq "$(way)" ""
ifeq "$(GhcWithInterpreter)" "YES"
all :: $(GHCI_LIBRARY)
$(GHCI_LIBRARY) :: $(GHCI_LIBOBJS)
ld -r -x -o $@ $(GHCI_LIBOBJS) $(STUBOBJS)
+INSTALL_LIBS += $(GHCI_LIBRARY)
CLEAN_FILES += $(GHCI_LIBRARY)
endif
endif
+endif
#----------------------------------------
# Building Win32 DLLs
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 $@...
@echo Done.
endif
-# links to script programs: we sometimes install a script as
-# <name>-<version> with a link from <name> to the real script.
+# ---------------------------------------------------------------------------
+# Symbolic links
+
+# links to programs: we sometimes install a program as
+# <name>-<version> with a link from <name> to the real program.
+
+ifneq "$(LINK)" ""
-ifneq "$(SCRIPT_LINK)" ""
-all :: $(SCRIPT_LINK)
+all :: $(LINK)
+
+CLEAN_FILES += $(LINK)
+
+ifeq "$(LINK_TARGET)" ""
+ifneq "$(SCRIPT_PROG)" ""
+LINK_TARGET = $(SCRIPT_PROG)
+else
+ifneq "$(HS_PROG)" ""
+LINK_TARGET = $(HS_PROG)
+else
+ifneq "$(C_PROG)" ""
+LINK_TARGET = $(C_PROG)
+else
+LINK_TARGET = dunno
+endif
+endif
+endif
+endif
#
-# Don't want to overwrite $(SCRIPT_LINK)s that aren't symbolic
+# Don't want to overwrite $(LINK)s that aren't symbolic
# links. Testing for symbolic 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 ( $(PERL) -e '$$fn="$(SCRIPT_LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
- echo "Creating a symbolic link from $(SCRIPT_PROG) to $(SCRIPT_LINK)"; \
- $(RM) $(SCRIPT_LINK); \
- $(LN_S) $(SCRIPT_PROG) $(SCRIPT_LINK); \
+$(LINK) : $(LINK_TARGET)
+ @if ( $(PERL) -e '$$fn="$(LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
+ echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK)"; \
+ $(RM) $(LINK); \
+ $(LN_S) $(LINK_TARGET) $(LINK); \
else \
- echo "Creating a symbolic link from $(SCRIPT_PROG) to $(SCRIPT_LINK) failed: \`$(SCRIPT_LINK)' already exists"; \
- echo "Perhaps remove \`$(SCRIPT_LINK)' manually?"; \
+ echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) failed: \`$(LINK)' already exists"; \
+ echo "Perhaps remove \`$(LINK)' manually?"; \
+ exit 1; \
+ fi;
+
+
+#
+# install links to script drivers.
+#
+install ::
+ @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); \
+ $(LN_S) $(LINK_TARGET) $(bindir)/$(LINK); \
+ else \
+ echo "Creating a symbol link from $(LINK_TARGET) to $(LINK) in $(bindir) failed: \`$(bindir)/$(LINK)' already exists"; \
+ echo "Perhaps remove \`$(bindir)/$(LINK)' manually?"; \
exit 1; \
fi;
-endif
+endif # LINK
###########################################
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
@$(MAKE) EXTRA_INSTALL_OPTS='-s' install
endif
-#
-# install links to script drivers.
-#
-ifneq "$(SCRIPT_LINK)" ""
-install ::
- @if ( $(PERL) -e '$$fn="$(bindir)/$(SCRIPT_LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
- echo "Creating a symbol link from $(SCRIPT_PROG) to $(SCRIPT_LINK) in $(bindir)"; \
- $(RM) $(bindir)/$(SCRIPT_LINK); \
- $(LN_S) $(SCRIPT_PROG) $(bindir)/$(SCRIPT_LINK); \
- else \
- echo "Creating a symbol link from $(SCRIPT_PROG) to $(SCRIPT_LINK) in $(bindir) failed: \`$(bindir)/$(SCRIPT_LINK)' already exists"; \
- echo "Perhaps remove \`$(bindir)/$(SCRIPT_LINK)' manually?"; \
- exit 1; \
- fi;
-
-endif
-
###########################################
#
# Targets: check tags show