BaseTools/Source/Python/AutoGen/GenMake.py:
authorjljusten <jljusten@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 12 Oct 2007 06:41:46 +0000 (06:41 +0000)
committerjljusten <jljusten@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 12 Oct 2007 06:41:46 +0000 (06:41 +0000)
  Changed separate 'cd' and 'make' commands to be on a single line
  to be compatible with GNU make.  For example, this:
    cd foo
    make bar
  becomes:
    cd foo && make bar
  It should be noted that ideally gnu makefiles would be generated as:
    make -C foo bar
  but for now, this solution can be shared for nmake and gnu make.

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@821 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/AutoGen/GenMake.py

index c4663ca..f63ef07 100755 (executable)
@@ -46,8 +46,7 @@ gMakefileHeader = '''#
 #\r
 '''\r
 \r
-gLibraryMakeCommand = '''cd %(makedir)s\r
-\t"$(MAKE)" $(MAKE_FLAGS) %(target)s\r
+gLibraryMakeCommand = '''cd %(makedir)s && "$(MAKE)" $(MAKE_FLAGS) %(target)s\r
 \tcd $(MODULE_BUILD_DIR)'''\r
 \r
 gMakeType = ""\r
@@ -205,7 +204,7 @@ mbuild: init all
 #\r
 init:\r
 \t-@echo Building ... $(MODULE_NAME) $(MODULE_VERSION) [$(ARCH)] in platform $(PLATFORM_NAME) $(PLATFORM_VERSION)\r
-\t${BEGIN}@${create_directory_command}\r
+\t${BEGIN}-@${create_directory_command}\r
 \t${END}\r
 \r
 '''\r
@@ -358,23 +357,21 @@ fds: mbuild gen_fds
 #\r
 init:\r
 \t-@echo Building ... $(MODULE_NAME) $(MODULE_VERSION) [$(ARCH)] in platform $(PLATFORM_NAME) $(PLATFORM_VERSION)\r
-\t${BEGIN}@${create_directory_command}\r
+\t${BEGIN}-@${create_directory_command}\r
 \t${END}\r
 \r
 #\r
 # GenLibsTarget\r
 #\r
 gen_libs:\r
-\t${BEGIN}cd $(BUILD_DIR)${separator}$(ARCH)${separator}${dependent_library_build_directory}\r
-\t"$(MAKE)" $(MAKE_FLAGS)\r
+\t${BEGIN}cd $(BUILD_DIR)${separator}$(ARCH)${separator}${dependent_library_build_directory} && "$(MAKE)" $(MAKE_FLAGS)\r
 \t${END}cd $(MODULE_BUILD_DIR)\r
 \r
 #\r
 # Build Flash Device Image\r
 #\r
 gen_fds:\r
-\tcd $(BUILD_DIR)\r
-\t"$(MAKE)" $(MAKE_FLAGS) fds\r
+\tcd $(BUILD_DIR) && "$(MAKE)" $(MAKE_FLAGS) fds\r
 \tcd $(MODULE_BUILD_DIR)\r
 \r
 #\r
@@ -412,8 +409,7 @@ cleanpch:
 #\r
 \r
 cleanlib:\r
-\t${BEGIN}cd $(BUILD_DIR)${separator}$(ARCH)${separator}${dependent_library_build_directory}\r
-\t"$(MAKE)" $(MAKE_FLAGS) cleanall\r
+\t${BEGIN}cd $(BUILD_DIR)${separator}$(ARCH)${separator}${dependent_library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) cleanall\r
 \t${END}cd $(MODULE_BUILD_DIR)\r
 \r
 '''\r
@@ -455,7 +451,7 @@ all: init build_libraries build_modules build_fds
 #\r
 init:\r
 \t-@echo Building ... $(PLATFORM_NAME) $(PLATFORM_VERSION) [${build_architecture_list}]\r
-\t${BEGIN}@${create_directory_command}\r
+\t${BEGIN}-@${create_directory_command}\r
 \t${END}\r
 #\r
 # library build target\r
@@ -476,16 +472,17 @@ fds: init build_fds
 # Build all libraries:\r
 #\r
 build_libraries:\r
-\t${BEGIN}cd $(WORKSPACE)${separator}${library_build_directory}\r
-\t"$(MAKE)" $(MAKE_FLAGS) pbuild\r
+\t${BEGIN}\r
+\techo Building library: $(WORKSPACE)${separator}${library_build_directory}\r
+\tcd $(WORKSPACE)${separator}${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) pbuild\r
 \t${END}cd $(BUILD_DIR)\r
 \r
 #\r
 # Build all modules:\r
 #\r
 build_modules:\r
-\t${BEGIN}cd $(WORKSPACE)${separator}${module_build_directory}\r
-\t"$(MAKE)" $(MAKE_FLAGS) pbuild\r
+\t${BEGIN}echo Building module $(WORKSPACE)${separator}${module_build_directory}\r
+\tcd $(WORKSPACE)${separator}${module_build_directory} && "$(MAKE)" $(MAKE_FLAGS) pbuild\r
 \t${END}cd $(BUILD_DIR)\r
 \r
 #\r
@@ -507,10 +504,8 @@ run:
 # Clean intermediate files\r
 #\r
 clean:\r
-\t${BEGIN}cd $(WORKSPACE)${separator}${library_build_directory}\r
-\t"$(MAKE)" $(MAKE_FLAGS) clean\r
-\t${END}${BEGIN}cd $(WORKSPACE)${separator}${module_build_directory}\r
-\t"$(MAKE)" $(MAKE_FLAGS) clean\r
+\t${BEGIN}cd $(WORKSPACE)${separator}${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) clean\r
+\t${END}${BEGIN}cd $(WORKSPACE)${separator}${module_build_directory} && "$(MAKE)" $(MAKE_FLAGS) clean\r
 \t${END}cd $(BUILD_DIR)\r
 \r
 #\r
@@ -524,8 +519,7 @@ cleanall:
 # Clean all library files\r
 #\r
 cleanlib:\r
-\t${BEGIN}cd $(WORKSPACE)${separator}${library_build_directory}\r
-\t"$(MAKE)" $(MAKE_FLAGS) cleanall\r
+\t${BEGIN}cd $(WORKSPACE)${separator}${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) cleanall\r
 \t${END}cd $(BUILD_DIR)\r
 \r
 '''\r