Fix MACH32/MACH64 so more than one architecture can build in the same workspace
authorNorm Jacobs <Norm.Jacobs@Sun.COM>
Wed, 19 May 2010 00:08:03 -0500
changeset 12 41aeb1fd8c2d
parent 11 0839bb401298
child 13 fd03fe8baefa
Fix MACH32/MACH64 so more than one architecture can build in the same workspace
components/file/Makefile
components/lcms/Makefile
components/pycups/Makefile
make-rules/configure.mk
make-rules/ips.mk
make-rules/prep.mk
make-rules/setup.py.mk
make-rules/shared-macros.mk
--- a/components/file/Makefile	Mon May 17 13:19:20 2010 -0500
+++ b/components/file/Makefile	Wed May 19 00:08:03 2010 -0500
@@ -41,10 +41,8 @@
 PKGMOGRIFY_TRANSFORMS +=	$(WS_TOP)/transforms/libtool-drop
 
 # common targets
-build:		$(COMPONENT_SRC)/build-32/.built \
-		$(COMPONENT_SRC)/build-64/.built
+build:		$(BUILD_32_and_64)
 
-install:	$(COMPONENT_SRC)/build-32/.installed \
-		$(COMPONENT_SRC)/build-64/.installed
+install:	$(INSTALL_32_and_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
--- a/components/lcms/Makefile	Mon May 17 13:19:20 2010 -0500
+++ b/components/lcms/Makefile	Wed May 19 00:08:03 2010 -0500
@@ -44,10 +44,8 @@
 COMPONENT_PREP_ACTION=	$(RM) $(@D)/include/icc34.h
 
 # common targets
-build:		$(COMPONENT_SRC)/build-32/.built \
-		$(COMPONENT_SRC)/build-64/.built
+build:		$(BUILD_32_and_64)
 
-install:	$(COMPONENT_SRC)/build-32/.installed \
-		$(COMPONENT_SRC)/build-64/.installed
+install:	$(INSTALL_32_and_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
--- a/components/pycups/Makefile	Mon May 17 13:19:20 2010 -0500
+++ b/components/pycups/Makefile	Wed May 19 00:08:03 2010 -0500
@@ -40,10 +40,8 @@
 PYTHON_ENV +=	CFLAGS=-DVERSION=\\\"$(COMPONENT_VERSION)\\\"
 
 # common targets
-build:		$(COMPONENT_SRC)/build-32/.built \
-		$(COMPONENT_SRC)/build-64/.built
+build:		$(BUILD_32_and_64)
 
-install:	$(COMPONENT_SRC)/build-32/.installed \
-		$(COMPONENT_SRC)/build-64/.installed
+install:	$(INSTALL_32_and_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
--- a/make-rules/configure.mk	Mon May 17 13:19:20 2010 -0500
+++ b/make-rules/configure.mk	Wed May 19 00:08:03 2010 -0500
@@ -31,11 +31,11 @@
 # and define "build", "install" targets appropriate to building your component.
 # Ex:
 #
-# 	build:		$(COMPONENT_SRC)/build-32/.built \
-#	 		$(COMPONENT_SRC)/build-64/.built
+# 	build:		$(COMPONENT_SRC)/build-$(MACH32)/.built \
+#	 		$(COMPONENT_SRC)/build-$(MACH64)/.built
 # 
-#	install:	$(COMPONENT_SRC)/build-32/.installed \
-#	 		$(COMPONENT_SRC)/build-64/.installed
+#	install:	$(COMPONENT_SRC)/build-$(MACH32)/.installed \
+#	 		$(COMPONENT_SRC)/build-$(MACH64)/.installed
 #
 # Any additional pre/post configure, build, or install actions can be specified
 # in your make file by setting them in on of the following macros:
@@ -58,8 +58,8 @@
 CONFIGURE_OPTIONS.64 = --bindir=/usr/bin/$(MACH64)
 CONFIGURE_OPTIONS.64 += --libdir=/usr/lib/$(MACH64)
 
-$(COMPONENT_SRC)/build-32/.configured:	BITS=32
-$(COMPONENT_SRC)/build-64/.configured:	BITS=64
+$(COMPONENT_SRC)/build-$(MACH32)/.configured:	BITS=32
+$(COMPONENT_SRC)/build-$(MACH64)/.configured:	BITS=64
 
 CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
 
--- a/make-rules/ips.mk	Mon May 17 13:19:20 2010 -0500
+++ b/make-rules/ips.mk	Wed May 19 00:08:03 2010 -0500
@@ -29,8 +29,8 @@
 # and define an "install" target appropriate to building your component.
 # Ex:
 #
-#	install:	$(COMPONENT_SRC)/build-32/.installed \
-#	 		$(COMPONENT_SRC)/build-64/.installed
+#	install:	$(COMPONENT_SRC)/build-$(MACH32)/.installed \
+#	 		$(COMPONENT_SRC)/build-$(MACH64)/.installed
 #
 # This set of rules makes the "publish" target the default target for make(1)
 #
@@ -45,6 +45,8 @@
 PKGMOGRIFY_TRANSFORMS +=	$(WS_TOP)/transforms/devel
 PKGMOGRIFY_TRANSFORMS +=	$(WS_TOP)/transforms/docs
 
+MANIFEST =	manifest-$(MACH)
+
 .DEFAULT:	publish
 
 publish:	$(COMPONENT_SRC)/.published
@@ -54,10 +56,10 @@
 $(PROTO_DIR)/$(COPYRIGHT_FILE):	$(COMPONENT_COPYRIGHT)
 	$(CP) $< [email protected]
 
-$(COMPONENT_SRC)/manifest:	install
+$(COMPONENT_SRC)/$(MANIFEST):	install
 	pkgsend generate $(PROTO_DIR) >[email protected]
 
-$(COMPONENT_SRC)/manifest.mog:	$(COMPONENT_SRC)/manifest $(PROTO_DIR)/$(COPYRIGHT_FILE)
+$(COMPONENT_SRC)/$(MANIFEST).mog:	$(COMPONENT_SRC)/$(MANIFEST) $(PROTO_DIR)/$(COPYRIGHT_FILE)
 	echo "set name=pkg.fmri value=pkg:/$(PUBLISHER)/$(COMPONENT_NAME)@$(COMPONENT_VERSION),$(BUILD_VERSION)" >[email protected]
 	echo "set name=pkg.description value=\"$(COMPONENT_DESCRIPTION)\"" >>[email protected]
 	echo "set name=pkg.name value=\"$(COMPONENT_DESCRIPTION)\"" >>[email protected]
@@ -65,13 +67,13 @@
 	echo "license $(COPYRIGHT_FILE) license=$(COPYRIGHT_FILE)" >>[email protected]
 	pkgmogrify $(PKGMOGRIFY_MACROS:%=-D %) $(PKGMOGRIFY_TRANSFORMS) $< >>[email protected]
 
-$(COMPONENT_SRC)/manifest.fdeps:	$(COMPONENT_SRC)/manifest.mog
+$(COMPONENT_SRC)/$(MANIFEST).fdeps:	$(COMPONENT_SRC)/$(MANIFEST).mog
 	pkgdepend generate -m $< $(PROTO_DIR) >[email protected]
 
-$(COMPONENT_SRC)/manifest.fdeps.res:	$(COMPONENT_SRC)/manifest.fdeps
+$(COMPONENT_SRC)/$(MANIFEST).fdeps.res:	$(COMPONENT_SRC)/$(MANIFEST).fdeps
 	pkgdepend resolve -m $<
 
-$(COMPONENT_SRC)/.published:	$(COMPONENT_SRC)/manifest.fdeps.res
+$(COMPONENT_SRC)/.published:	$(COMPONENT_SRC)/$(MANIFEST).fdeps.res
 	pkgsend -s $(PKG_REPO) publish --fmri-in-manifest \
 		-d $(PROTO_DIR) $<
 	$(TOUCH) [email protected]
--- a/make-rules/prep.mk	Mon May 17 13:19:20 2010 -0500
+++ b/make-rules/prep.mk	Wed May 19 00:08:03 2010 -0500
@@ -27,12 +27,11 @@
 CLEAN_PATHS += $(COMPONENT_SRC)
 CLOBBER_PATHS += $(COMPONENT_ARCHIVE)
 
-#PATCHES =	$(shell ls *.patch) #find . -type f -name '*.patch'
 PATCHES =	$(shell find . -type f -name '*.patch' | \
 			 sed -e 's;^\./;;' | sort)
-STAMPS =	$(PATCHES:%=$(COMPONENT_SRC)/.patched.%)
+STAMPS =	$(PATCHES:%=$(COMPONENT_SRC)/.%ed)
 
-$(COMPONENT_SRC)/.patched.%:	%
+$(COMPONENT_SRC)/.%ed:	%
 	$(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
 	$(TOUCH) [email protected]
 
--- a/make-rules/setup.py.mk	Mon May 17 13:19:20 2010 -0500
+++ b/make-rules/setup.py.mk	Wed May 19 00:08:03 2010 -0500
@@ -21,10 +21,10 @@
 # Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
 #
 
-$(COMPONENT_SRC)/build-32/.built:	BITS=32
-$(COMPONENT_SRC)/build-64/.built:	BITS=64
-$(COMPONENT_SRC)/build-32/.installed:	BITS=32
-$(COMPONENT_SRC)/build-64/.installed:	BITS=64
+$(COMPONENT_SRC)/build-$(MACH32)/.built:	BITS=32
+$(COMPONENT_SRC)/build-$(MACH64)/.built:	BITS=32
+$(COMPONENT_SRC)/build-$(MACH32)/.installed:	BITS=32
+$(COMPONENT_SRC)/build-$(MACH64)/.installed:	BITS=64
 
 
 # build the configured source
--- a/make-rules/shared-macros.mk	Mon May 17 13:19:20 2010 -0500
+++ b/make-rules/shared-macros.mk	Wed May 19 00:08:03 2010 -0500
@@ -34,11 +34,28 @@
 MAKE_RULES =	$(WS_TOP)/components/make-rules
 
 PKG_REPO =	file://$(WS_TOP)/repo
-PROTO_DIR =	$(shell pwd)/$(COMPONENT_SRC)/installed-prototype
+PROTO_DIR =	$(shell pwd)/$(COMPONENT_SRC)/installed-prototype-$(MACH)
 
 CONSTANT_TIME =	LD_PRELOAD=$(TOOLS)/time.o
 
-MACH64 =	$(shell isainfo -k)
+# set MACH from uname -p to either sparc or i386
+MACH =		$(shell uname -p)
+
+# set MACH32 from MACH to either sparcv7 or i86
+MACH32_1 =	$(MACH:sparc=sparcv7)
+MACH32 =	$(MACH32_1:i386=i86)
+
+# set MACH64 from MACH to either sparcv9 or amd64
+MACH64_1 =	$(MACH:sparc=sparcv9)
+MACH64 =	$(MACH64_1:i386=amd64)
+
+BUILD_32 =		$(COMPONENT_SRC)/build-$(MACH32)/.built
+BUILD_64 =		$(COMPONENT_SRC)/build-$(MACH64)/.built
+BUILD_32_and_64 =	$(BUILD_32) $(BUILD_64)
+
+INSTALL_32 =		$(COMPONENT_SRC)/build-$(MACH32)/.installed
+INSTALL_64 =		$(COMPONENT_SRC)/build-$(MACH64)/.installed
+INSTALL_32_and_64 =	$(INSTALL_32) $(INSTALL_64)
 
 SPRO_ROOT =	/opt/sunstudio12.1
 GCC_ROOT =	/usr/gnu