This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Make $(native-compile) run in source directory like other compilationcommands


Last month's discussion of cross-rpcgen led to a desire to have some
common set of makefile rules or variables used for building things for
the build system rather than replicating such rules for both
$(native-compile) and cross-rpcgen.  See the thread starting at
<http://sourceware.org/ml/libc-alpha/2012-03/msg00325.html>, most
recent message
<http://sourceware.org/ml/libc-alpha/2012-03/msg00380.html>.

I propose this patch as an intermediate step towards this: it moves
$(native-compile) to the usual approach in glibc of running
compilation commands from the source directory, rather than using a
compilation command that changes directory to the object directory to
run the build.  (The cross-rpcgen build commands are intended to work
that way.)  Tested x86_64.  I intend subsequent patches to add the use
of BUILD_CPPFLAGS, BUILD_LDFLAGS and -DIS_IN_build (as per
<http://sourceware.org/ml/libc-alpha/2012-03/msg00358.html>) before
actually setting up some form of common variables for use of
cross-rpcgen.

2012-04-24  Joseph Myers  <joseph@codesourcery.com>

	* Makerules (native-compile): Do not change working directory for
	build.  Use $(OUTPUT_OPTION) in command.
	(ALL_BUILD_CFLAGS): Use $(common-objpfx) to find config.h.

diff --git a/Makerules b/Makerules
index d184be6..a9b1786 100644
--- a/Makerules
+++ b/Makerules
@@ -1114,17 +1114,15 @@ install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
 endif
 install: install-no-libc.a-nosubdir
 
-# Command to compile $< in $(objdir) using the native libraries.
+# Command to compile $< using the native libraries.
 define native-compile
 $(make-target-directory)
-$(patsubst %/,cd % &&,$(objpfx)) \
 $(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
-	    $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
+	    $< $(OUTPUT_OPTION)
 endef
 
 # We always want to use configuration definitions.
-# Note that this is only used for commands running in $(objpfx).
-ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
+ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(common-objpfx)config.h
 
 # Support the GNU standard name for this target.
 .PHONY: check

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]