develooper Front page | perl.perl6.internals | Postings from December 2001

Better temporary Makefile patch

Thread Next
From:
Andy Dougherty
Date:
December 13, 2001 11:29
Subject:
Better temporary Makefile patch
Message ID:
Pine.SOL.4.10.10112130934590.2960-100000@maxwell.phys.lafayette.edu
This patch fixes up Makefile.in to handle subdirectories along the lines
I suggested yesterday.  (The make -C trick is GNU-specific and hence not
portable, and the cd dir; $(MAKE) trick is Unix-specific and hence not
portable.)  This is a "temporary" patch because a perl-based build system
will render some of this obsolete. 

I think the 

	cd foo && $(MAKE) && cd ..

idiom will work on Windows NT and XP, but I don't have any way to test
that myself.  (Note that for directories 2 levels deep, we cd one
directory at a time to avoid forward-backward slash confusion.)

I imagine this still won't work on VMS, but that's a much bigger nut to
crack, and a simple textual-substitution-based Makefile.in scheme is
probably not the way to go there.  

diff -r -u parrot/Configure.pl parrot-andy/Configure.pl
--- parrot/Configure.pl	Thu Dec 13 08:11:11 2001
+++ parrot-andy/Configure.pl	Thu Dec 13 09:09:15 2001
@@ -92,6 +92,7 @@
 	strlow =>	'(~0xfff)',
 	pmclow =>	'(~0xfff)',
 	make=>          $Config{make},
+	make_set_make=>          $Config{make_set_make},
 	
 	platform =>	$^O,
 	cp =>		'cp',
diff -r -u parrot/Makefile.in parrot-andy/Makefile.in
--- parrot/Makefile.in	Thu Dec 13 08:11:11 2001
+++ parrot-andy/Makefile.in	Thu Dec 13 09:09:35 2001
@@ -33,7 +33,9 @@
 PERL = ${perl}
 TEST_PROG = parrot${exe}
 PDUMP = pdump${exe}
-MAKE_F = ${make}
+# This is set to  MAKE=$make if your $make command doesn't
+# do it for you.
+${make_set_make}
 
 .c$(O):
 	$(CC) $(CFLAGS) ${ld_out}$@ -c $<
@@ -56,7 +58,7 @@
 test_main$(O): $(H_FILES)
 
 examples/assembly/mops.pbc: examples/assembly/mops.pasm assemble.pl
-	$(MAKE) -C examples/assembly mops.pbc PERL=$(PERL)
+	cd examples && cd assembly && $(MAKE) mops.pbc PERL=$(PERL) && cd .. && cd ..
 
 Parrot/OpLib/core.pm: core.ops ops2pm.pl
 	$(PERL) ops2pm.pl core.ops vtable.ops
@@ -132,15 +134,15 @@
 docs: docs/.dummy
 
 docs/.dummy:
-	$(MAKE) -C docs
+	cd docs && $(MAKE) && cd ..
 
 $(CLASS_O_FILES):
-	$(MAKE) -C classes
+	cd classes && $(MAKE) && cd ..
 
 languages: languages.dummy
 
 languages.dummy:
-	$(MAKE) -C languages
+	cd languages && $(MAKE) && cd ..
 
 clean:
 	$(RM_F) *$(O) chartypes/*$(O) encodings/*$(O)
@@ -153,9 +155,9 @@
 	$(RM_F) examples/assembly/mops$(EXE) examples/assembly/mops.c
 	$(RM_F) examples/assembly/mops$(O) examples/assembly/mops.pbc
 	$(RM_F) Parrot/OpLib/core.pm
-	$(MAKE) -C docs clean
-	$(MAKE) -C classes clean
-	$(MAKE) -C languages clean
+	cd docs && $(MAKE) clean && cd ..
+	cd classes && $(MAKE) clean && cd ..
+	cd languages && $(MAKE) clean && cd ..
 
 distclean:
 	$(PERL) -MExtUtils::Manifest=filecheck -le '$$ExtUtils::Manifest::Quiet=1;unlink $$_ for filecheck()'

-- 
    Andy Dougherty		doughera@lafayette.edu
    Dept. of Physics
    Lafayette College, Easton PA 18042


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About