[MLton-commit] r5259

Vesa Karvonen vesak at mlton.org
Mon Feb 19 04:06:24 PST 2007


Use target specific directories for everything generated to make it
possible to compile on multiple machines at the same time.

----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/misc-util/unstable/Makefile

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/misc-util/unstable/Makefile
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/Makefile	2007-02-19 07:39:49 UTC (rev 5258)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/Makefile	2007-02-19 12:06:24 UTC (rev 5259)
@@ -11,10 +11,19 @@
 
 gen-dir := generated/$(target-id)
 
+mlb-path-map := $(gen-dir)/mlb-path-map
+
 ffi-h-files := $(wildcard *.h)
-
 nlffi-mlb := $(gen-dir)/nlffi/lib.mlb
 
+test-exe := $(gen-dir)/test
+
+ifeq ($(target-os),mingw)
+link-opt :=
+else
+link-opt := -link-opt -ldl
+endif
+
 ##########################################################################
 
 .PHONY : all check clean help
@@ -29,10 +38,10 @@
 all : $(nlffi-mlb)
 
 clean :
-	rm -rf mlb-path-map test $(wildcard *.dep) $(gen-dir)
+	rm -rf $(gen-dir)
 
-check : test
-	./test
+check : $(test-exe)
+	./$(test-exe)
 
 ##########################################################################
 
@@ -43,23 +52,24 @@
 	           -linkage static  \
 	           $^
 
-mlb-path-map : Makefile
+$(mlb-path-map) : Makefile
+	mkdir -p $(@D)
 	echo 'MLTON_LIB $(shell cd ../../../.. && pwd)' > $@
 	echo 'SML_COMPILER mlton' >> $@
 
-test : test.mlb mlb-path-map $(nlffi-mlb)
-	mlton -stop f -mlb-path-map mlb-path-map $<          \
+$(test-exe) : test.mlb $(mlb-path-map) $(nlffi-mlb)
+	mlton -stop f -mlb-path-map $(mlb-path-map) $<       \
 	  | sed $$'s#\r##g'                                  \
 	  | awk 'BEGIN { printf "$@ :" } { printf " " $$1 }' \
 	  > $@.dep
-	mlton -mlb-path-map mlb-path-map     \
-	      -prefer-abs-paths true         \
-	      -show-def-use $@.def-use       \
-	      -const 'Exn.keepHistory true'  \
-	      -link-opt -ldl                 \
-	      -output $@                     \
+	mlton -mlb-path-map $(mlb-path-map)                  \
+	      -prefer-abs-paths true                         \
+	      -show-def-use $@.du                            \
+	      -const 'Exn.keepHistory true'                  \
+	      $(link-opt)                                    \
+	      -output $@                                     \
 	      $<
 
 ##########################################################################
 
-include $(wildcard *.dep)
+include $(wildcard $(gen-dir)/*.dep)




More information about the MLton-commit mailing list