[vlc-devel] [PATCH 3/3] contrib: Make sure we can live with multiple contribs set for different targets.

Pierre d'Herbemont pdherbemont at free.fr
Sat Sep 25 23:51:10 CEST 2010


Move distro.mak in the src-$(HOST)-$(DISTRO) dir instead of the root dir, and use  a copy of config.mak in src-$(HOST)-$(DISTRO).
---
 extras/contrib/Makefile  |   27 +++++++++++++++++++++------
 extras/contrib/bootstrap |    6 +++---
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/extras/contrib/Makefile b/extras/contrib/Makefile
index f1ef565..c842710 100644
--- a/extras/contrib/Makefile
+++ b/extras/contrib/Makefile
@@ -26,7 +26,7 @@
 
 include ./config.mak
 
-BUILDDIRS = hosts build
+BUILDDIRS = hosts build src-*
 
 ifdef HAVE_DARWIN_OS
 TARGETALL=using-bin
@@ -36,8 +36,24 @@ endif
 
 all: $(TARGETALL)
 
-using-src:
-	$(MAKE) -C src
+SRC_BUILD_DIR=src-$(HOST)-$(DISTRO)/src
+
+$(SRC_BUILD_DIR)/../distro.mak: src/Distributions/${DISTRO}.mak
+	cp $< $@
+
+$(SRC_BUILD_DIR)/../config.mak: config.mak
+	cp $< $@
+
+$(SRC_BUILD_DIR):
+	mkdir -p $(SRC_BUILD_DIR)
+
+$(SRC_BUILD_DIR)/Makefile: $(SRC_BUILD_DIR) $(SRC_BUILD_DIR)/../distro.mak $(SRC_BUILD_DIR)/../config.mak
+	ln -sf ../../src/Patches $(SRC_BUILD_DIR)
+	ln -sf ../../src/packages.mak $(SRC_BUILD_DIR)
+	ln -sf ../../src/Makefile $(SRC_BUILD_DIR)/Makefile
+
+using-src: $(SRC_BUILD_DIR)/Makefile
+	$(MAKE) -C $(SRC_BUILD_DIR)
 ifdef HAVE_DARWIN_10
 	(cd $(PREFIX)/lib && sed -e 's%/usr/lib/libiconv.la%$(PREFIX)/lib/libiconv.la%g' -i.orig *.la && rm -f *.la.orig)
 endif
@@ -80,15 +96,14 @@ endif
 
 clean:
 	rm -rf $(BUILDDIRS)
-	$(MAKE) -C src clean
 
 clean-bin:
 	rm -rf $(BUILDDIRS)
-	$(MAKE) -C src clean-dots
+	$(MAKE) -C $(SRC_BUILD_DIR) clean-dots
 
 distclean:
 	$(MAKE) clean
-	$(MAKE) -C src clean-src
+	$(MAKE) -C $(SRC_BUILD_DIR) clean-src
 	rm -rf config.mak distro.mak
 
 bin: using-bin
diff --git a/extras/contrib/bootstrap b/extras/contrib/bootstrap
index c0383e0..f92609d 100755
--- a/extras/contrib/bootstrap
+++ b/extras/contrib/bootstrap
@@ -26,7 +26,7 @@
 
 if test "$#" -gt "2" -o "$1" = "-h" -o "$1" = "--help" ; then
     echo "Usage: $0 [host [distro]]" >&2
-    echo "  Prepare config.mak and distro.mak file." >&2
+    echo "  Prepare config.mak file." >&2
     exit 1
 fi
 
@@ -139,6 +139,7 @@ case $HOST in
         fi
     ;;
     i686-apple-darwin*)
+        echo "Building for $DISTRO"
         SDK_TARGET=10.5
         MIN_LD_VERSION_WITH_TEXT_RELOCATION=81
         echo "SDK_TARGET = ${SDK_TARGET}" >> config.mak
@@ -285,8 +286,6 @@ fi
 # Default Unix-like systems
 test -z "${DISTRO}" && DISTRO=unix
 
-cat src/Distributions/"${DISTRO}".mak >> distro.mak
-
 echo "BUILD = $BUILD" >> config.mak
 echo "HOST = $HOST" >> config.mak
 
@@ -309,6 +308,7 @@ echo "EXTRA_CFLAGS = ${CFLAGS_TUNING} ${EXTRA_CFLAGS}" >> config.mak
 echo "EXTRA_CPPFLAGS = ${EXTRA_CPPFLAGS} -isystem \$(PREFIX)/include" >> config.mak
 echo "EXTRA_LDFLAGS = ${EXTRA_LDFLAGS}" >> config.mak
 echo "EXTRA_PATH = ${EXTRA_PATH}" >> config.mak
+echo "DISTRO = ${DISTRO}" >> config.mak
 
 #CMAKE
 if test "$HOST" != "$BUILD"; then
-- 
1.7.1.1




More information about the vlc-devel mailing list