Make versioned ghc and ghci programs on Windows; fixes trac #2827
[ghc-hetmet.git] / driver / mangler / Makefile
index 7b482e1..1242d6c 100644 (file)
@@ -4,19 +4,23 @@
 TOP=../..
 include $(TOP)/mk/boilerplate.mk
 
-SCRIPT_PROG    = ghc-asm
+PROG = ghc-asm
+all:: $(PROG).prl
+       $(RM) -f $(PROG)
+       echo '#!$(PERL)'                                >> $(PROG)
+       echo '$$TARGETPLATFORM  = "$(TARGETPLATFORM)";' >> $(PROG)
+       cat $<                                          >> $(PROG)
+       $(EXECUTABLE_FILE) $(PROG)
 
-INTERP=perl
-
-SCRIPT_SUBST_VARS := TARGETPLATFORM
-
-INSTALL_LIBEXEC_SCRIPTS += $(SCRIPT_PROG)
-
-CLEAN_FILES += $(SCRIPT_OBJS)
+INSTALL_LIBEXEC_SCRIPTS += $(PROG)
+CLEAN_FILES += $(PROG) $(PROG).prl
 
 # needed for bootstrapping with HC files
 ifeq "$(BootingFromHc)" "YES"
 boot :: all
 endif
 
+BINDIST_EXTRAS += $(PROG)
+include $(TOP)/mk/bindist.mk
+
 include $(TOP)/mk/target.mk