소스 검색

* platforms/linux.make (PLATFORM_CHANGE_SEPARATOR_CMD): Define to 'cat'.
(PLATFORM_TWEAK_CORLIB_SOURCES): Remove.
(platform-check): Avoid bash-ism.
* library.make: Simplify uses of $(patsubst x,y,$(foo)) to $(foo:x=y).
(core_sourcefile): Rename back to ...
(sourcefile): ... this. Remove creation of redundant intermediate file.
(response): Change test for optimization, now that
PLATFORM_CHANGE_SEPARATOR_CMD is unconditional. Combine with
platform-exclude handling.
(library_CLEAN_FILES): New variable to specify clean:-able files
close to where they're defined.
(test_response, btest_response): Simplify.
* executable.make (response): Change test for optimization.
(executable_CLEAN_FILES): New define.

Maintainability improvements. Sorry, I'm still in the scratch-an-itch
mode with the build stuff :-)

svn path=/trunk/mcs/; revision=29490

Raja R Harinath 21 년 전
부모
커밋
65452698f3
4개의 변경된 파일57개의 추가작업 그리고 66개의 파일을 삭제
  1. 17 0
      mcs/build/ChangeLog
  2. 10 9
      mcs/build/executable.make
  3. 28 47
      mcs/build/library.make
  4. 2 10
      mcs/build/platforms/linux.make

+ 17 - 0
mcs/build/ChangeLog

@@ -1,3 +1,20 @@
+2004-06-14  Raja R Harinath  <[email protected]>
+
+	* platforms/linux.make (PLATFORM_CHANGE_SEPARATOR_CMD): Define to 'cat'.
+	(PLATFORM_TWEAK_CORLIB_SOURCES): Remove.
+	(platform-check): Avoid bash-ism.
+	* library.make: Simplify uses of $(patsubst x,y,$(foo)) to $(foo:x=y).
+	(core_sourcefile): Rename back to ...
+	(sourcefile): ... this.  Remove creation of redundant intermediate file.
+	(response): Change test for optimization, now that
+	PLATFORM_CHANGE_SEPARATOR_CMD is unconditional.  Combine with
+	platform-exclude handling.
+	(library_CLEAN_FILES): New variable to specify clean:-able files
+	close to where they're defined.
+	(test_response, btest_response): Simplify.
+	* executable.make (response): Change test for optimization.
+	(executable_CLEAN_FILES): New define.
+
 2004-06-14  Raja R Harinath  <[email protected]>
 
 	* library.make (uninstall-local): Fix typo.

+ 10 - 9
mcs/build/executable.make

@@ -8,13 +8,17 @@
 
 base_prog = $(shell basename $(PROGRAM))
 sourcefile = $(base_prog).sources
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-response = $(depsdir)/$(base_prog).response
-else
+
+ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
 response = $(sourcefile)
+else
+response = $(depsdir)/$(base_prog).response
+executable_CLEAN_FILES += $(response)
 endif
+
 makefrag = $(depsdir)/$(base_prog).makefrag
 pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
+executable_CLEAN_FILES += $(makefrag) $(pdb)
 
 ifndef PROGRAM_INSTALL_DIR
 PROGRAM_INSTALL_DIR = $(prefix)/bin
@@ -30,10 +34,7 @@ uninstall-local:
 	-rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog)
 
 clean-local:
-	-rm -f *.exe $(BUILT_SOURCES) $(CLEAN_FILES) $(pdb) $(makefrag)
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-	-rm -f $(response)
-endif
+	-rm -f *.exe $(BUILT_SOURCES) $(executable_CLEAN_FILES) $(CLEAN_FILES)
 
 test-local: $(PROGRAM)
 	@:
@@ -61,10 +62,10 @@ $(makefrag): $(sourcefile)
 	@echo Creating $@ ...
 	@sed 's,^,$(PROGRAM): ,' $< > $@
 
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
+ifneq ($(response),$(sourcefile))
 $(response): $(sourcefile)
 	@echo Creating $@ ...
-	@cat $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
+	@( $(PLATFORM_CHANGE_SEPARATOR_CMD) ) <$< >$@
 endif
 
 -include $(makefrag)

+ 28 - 47
mcs/build/library.make

@@ -8,21 +8,18 @@
 # All the dep files now land in the same directory so we
 # munge in the library name to keep the files from clashing.
 
-core_sourcefile = $(LIBRARY).sources
+sourcefile = $(LIBRARY).sources
 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
 
-ifdef PLATFORM_excludes
-sourcefile = $(depsdir)/$(LIBRARY).$(PLATFORM)-sources
-$(sourcefile): $(core_sourcefile) $(PLATFORM_excludes)
-	cat $(core_sourcefile) $(PLATFORM_excludes) | sort | uniq -u >$@
-else
-sourcefile = $(core_sourcefile)
+ifndef PLATFORM_excludes
+ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
+response = $(sourcefile)
+endif
 endif
 
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
+ifndef response
 response = $(depsdir)/$(PROFILE)_$(LIBRARY).response
-else
-response = $(sourcefile)
+library_CLEAN_FILES += $(response)
 endif
 
 ifndef LIBRARY_NAME
@@ -31,14 +28,14 @@ endif
 
 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
 the_lib = $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME)
-the_pdb = $(patsubst %.dll,%.pdb,$(the_lib))
+the_pdb = $(the_lib:.dll=.pdb)
+library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb)
 
 ifndef NO_TEST
-test_nunitfw = $(topdir)/class/lib/$(PROFILE)/nunit.framework.dll 
-test_nunitcore = $(topdir)/class/lib/$(PROFILE)/nunit.core.dll 
-test_nunitutil = $(topdir)/class/lib/$(PROFILE)/nunit.util.dll 
-test_nunit_dep = $(test_nunitfw) $(test_nunitcore) $(test_nunitutil)
-test_nunit_ref = -r:$(test_nunitfw) -r:$(test_nunitcore) -r:$(test_nunitutil)
+test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
+test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
+test_nunit_ref = $(test_nunit_dep:%=-r:%)
+library_CLEAN_FILES += TestResult.xml
 
 ifndef test_against
 test_against = $(the_lib)
@@ -46,22 +43,24 @@ test_dep = $(the_lib)
 endif
 
 ifndef test_lib
-test_lib = $(patsubst %.dll,%_test.dll,$(LIBRARY))
+test_lib = $(LIBRARY:.dll=_test.dll)
 endif
-test_pdb = $(patsubst %.dll,%.pdb,$(test_lib))
+test_pdb = $(test_lib:.dll=.pdb)
 test_sourcefile = $(test_lib).sources
 test_response = $(depsdir)/$(PROFILE)_$(test_lib).response
 test_makefrag = $(depsdir)/$(PROFILE)_$(test_lib).makefrag
 test_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
+library_CLEAN_FILES += $(test_lib) $(test_pdb) $(test_response) $(test_makefrag)
 
 ifndef btest_lib
-btest_lib = $(patsubst %.dll,%_btest.dll,$(LIBRARY))
+btest_lib = $(LIBRARY:.dll=_btest.dll)
 endif
-btest_pdb = $(patsubst %.dll,%.pdb,$(btest_lib))
+btest_pdb = $(btest_lib:.dll=.pdb)
 btest_sourcefile = $(btest_lib).sources
 btest_response = $(depsdir)/$(btest_lib).response
 btest_makefrag = $(depsdir)/$(btest_lib).makefrag
 btest_flags = /r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
+library_CLEAN_FILES += $(btest_lib) $(btest_pdb) $(btest_response) $(btest_makefrag)
 
 ifndef HAVE_CS_TESTS
 HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
@@ -99,7 +98,7 @@ install-local: $(gacutil)
 	$(RUNTIME) $(gacutil) /i $(the_lib) /f /root $(DESTDIR)$(prefix)/lib /package $(PACKAGE)
 
 uninstall-local: $(gacutil)
-	$(RUNTIME) $(gacutil) /u `echo $(LIBRARY_NAME) | sed 's,.dll$$,,'`
+	$(RUNTIME) $(gacutil) /u $(LIBRARY_NAME:.dll=)
 
 $(gacutil):
 	cd $(topdir)/tools/gacutil && $(MAKE)
@@ -116,17 +115,7 @@ $(sn):
 	cd $(topdir)/tools/security && $(MAKE) sn.exe
 
 clean-local:
-	-rm -f $(the_lib) $(makefrag) $(test_lib) \
-	       $(test_makefrag) $(test_response) \
-	       $(the_pdb) $(test_pdb) $(CLEAN_FILES) \
-	       TestResult.xml
-ifdef PLATFORM_excludes
-	-rm -rf $(sourcefile)
-endif
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-	-rm -rf $(response)
-endif
-
+	-rm -f $(library_CLEAN_FILES) $(CLEAN_FILES)
 
 test-local: $(the_lib)
 	@:
@@ -174,7 +163,7 @@ run-btest-ondotnet-lib: test-local
 
 endif
 
-DISTFILES = $(core_sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
+DISTFILES = $(sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES)
 
 TEST_FILES = 
 
@@ -186,7 +175,7 @@ TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
 endif
 
 dist-local: dist-default
-	for f in `cat $(core_sourcefile)` $(TEST_FILES) ; do \
+	for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
 	    dest=`dirname $(distdir)/$$f` ; \
 	    $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
 	done
@@ -212,10 +201,10 @@ $(makefrag): $(sourcefile)
 	@echo Creating $@ ...
 	@sed 's,^,$(the_lib): ,' $< >$@
 
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-$(response): $(sourcefile)
+ifneq ($(response),$(sourcefile))
+$(response): $(sourcefile) $(PLATFORM_excludes)
 	@echo Creating $@ ...
-	@cat $(sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
+	@sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
 endif
 
 -include $(makefrag)
@@ -230,11 +219,7 @@ $(test_lib): $(test_makefrag) $(test_dep) $(test_response) $(test_nunit_dep)
 
 $(test_response): $(test_sourcefile)
 	@echo Creating $@ ...
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-	@sed 's,^,Test/,' $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
-else
-	@sed 's,^,Test/,' $< >$@
-endif
+	@sed 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
 
 $(test_makefrag): $(test_response)
 	@echo Creating $@ ...
@@ -251,11 +236,7 @@ $(btest_lib): $(btest_makefrag) $(test_dep) $(btest_response) $(test_nunit_dep)
 
 $(btest_response): $(btest_sourcefile)
 	@echo Creating $@ ...
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-	@sed 's,^,Test/,' $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
-else
-	@sed 's,^,Test/,' $< >$@
-endif
+	@sed 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
 
 $(btest_makefrag): $(btest_response)
 	@echo Creating $@ ...

+ 2 - 10
mcs/build/platforms/linux.make

@@ -16,28 +16,20 @@ PLATFORM_PATH_SEPARATOR = :
 # Define this if this ever will work on Linux
 # PLATFORM_MAKE_CORLIB_CMP = yes
 
-# This is for the security permission attribute problem
-# on windows
-PLATFORM_TWEAK_CORLIB_SOURCES = cat
-
 # This is for changing / to \ on windows
-# Don't define it so we don't needlessly copy the sources
-# file. This command is handy for testing:
-#
-# PLATFORM_CHANGE_SEPARATOR_CMD=sed -e 's,/,/./,g'
+PLATFORM_CHANGE_SEPARATOR_CMD = cat
 
 hidden_prefix = .
 hidden_suffix = 
 
 platform-check:
-	@if ! type $(BOOTSTRAP_MCS) >/dev/null 2>&1 ; then \
+	@set fnord $(BOOTSTRAP_MCS) ; if type $$2 >/dev/null 2>&1 ; then :; else \
 	    echo "*** You need a C# compiler installed to build MCS. (make sure mcs works from the command line)" ; \
 	    echo "*** Read INSTALL.txt for information on how to bootstrap" ; \
 	    echo "*** a Mono installation." ; \
 	    exit 1 ; \
 	fi
 
-
 # I tried this but apparently Make's version strings aren't that
 # ... consistent between releases. Whatever.
 #