From 6a5579f8e8d4a085a8b50f40db8979f3808c2afd Mon Sep 17 00:00:00 2001 From: matthieu Date: Sat, 2 Dec 2006 16:28:48 +0000 Subject: [PATCH] Make 'obj' now can make symlinks to /usr/obj/xenocara (or any other directory designed by XENOCARA_OBJDIR in /etc/mk.conf). --- README | 6 +-- app/fvwm/Makefile.inc | 2 +- app/fvwm/modules/Makefile.inc | 2 +- app/fvwm/sample.fvwmrc/Makefile | 4 +- app/glxgears/Makefile | 2 + app/glxinfo/Makefile | 2 + app/ssh-askpass/Makefile | 4 +- app/wm2/Makefile | 2 + app/xidle/Makefile | 4 +- app/xsystrace/Makefile | 4 +- app/xvctl/Makefile | 4 +- lib/expat/Makefile | 6 ++- lib/freetype/Makefile | 5 ++- lib/libGL/Makefile | 2 + lib/libGLU/Makefile | 6 ++- lib/libGLw/Makefile | 4 +- share/mk/bsd.xorg.mk | 71 +++++++++++++++++++++++++++++---- 17 files changed, 106 insertions(+), 24 deletions(-) diff --git a/README b/README index aeaa180f3..e7bfc949e 100644 --- a/README +++ b/README @@ -82,9 +82,7 @@ to any module sub-directory and run 'make build' from there. Xenocara supports objdirs (and it's even the recommended way to build things). Just run 'make obj' at any level before 'make build' to make -sure the object directory is created. - -XXX support for objdirs needs to be improved! XXX +sure that the object directories are created. Shadow trees @@ -104,4 +102,4 @@ makefiles skeletons. For that use the following command: You can also set XENOCARA_RERUN_AUTOCONF in /etc/mk.conf to force regeneration of configure scripts in every component. -$OpenBSD: README,v 1.3 2006/11/30 17:58:48 matthieu Exp $ +$OpenBSD: README,v 1.4 2006/12/02 16:28:48 matthieu Exp $ diff --git a/app/fvwm/Makefile.inc b/app/fvwm/Makefile.inc index 7fa5758a3..e8000f326 100644 --- a/app/fvwm/Makefile.inc +++ b/app/fvwm/Makefile.inc @@ -13,7 +13,7 @@ CFLAGS+= -I${X11BASE}/include -I${.CURDIR} -I${.CURDIR}/.. \ FVWMLIBDIR= ${X11BASE}/lib/X11/fvwm MANDIR= ${X11BASE}/man/cat -.include +obj: _xenocara_obj .if exists(${.CURDIR}/../libs/${__objdir}) LDADD+= -L${X11BASE}/lib -L${.CURDIR}/../libs/${__objdir} -lfvwm diff --git a/app/fvwm/modules/Makefile.inc b/app/fvwm/modules/Makefile.inc index 14dd258c4..25d2456fd 100644 --- a/app/fvwm/modules/Makefile.inc +++ b/app/fvwm/modules/Makefile.inc @@ -12,7 +12,7 @@ CFLAGS+= -I${X11BASE}/include -I${.CURDIR}/../.. -I${.CURDIR}/../../libs FVWMLIBDIR= ${X11BASE}/lib/X11/fvwm MANDIR= ${X11BASE}/man/cat -.include +obj: _xenocara_obj .if exists(${.CURDIR}/../../libs/${__objdir}) LDADD+= -L${X11BASE}/lib -L${.CURDIR}/../../libs/${__objdir} -lfvwm diff --git a/app/fvwm/sample.fvwmrc/Makefile b/app/fvwm/sample.fvwmrc/Makefile index 082388ace..aaa1b093c 100644 --- a/app/fvwm/sample.fvwmrc/Makefile +++ b/app/fvwm/sample.fvwmrc/Makefile @@ -1,7 +1,9 @@ -# $OpenBSD: Makefile,v 1.2 2006/11/27 19:56:35 matthieu Exp $ +# $OpenBSD: Makefile,v 1.3 2006/12/02 16:28:48 matthieu Exp $ .include "../Makefile.inc" +NOOBJ=Yes + depend: all: diff --git a/app/glxgears/Makefile b/app/glxgears/Makefile index fbeddea39..ca9dde6ce 100644 --- a/app/glxgears/Makefile +++ b/app/glxgears/Makefile @@ -10,6 +10,8 @@ PROG= glxgears CPPFLAGS+= -I${X11BASE}/include LDADD+= -L${X11BASE}/lib -lGL -lXext -lX11 -lm +obj: _xenocara_obj + .include .include diff --git a/app/glxinfo/Makefile b/app/glxinfo/Makefile index 66b52ddb2..14b9357e4 100644 --- a/app/glxinfo/Makefile +++ b/app/glxinfo/Makefile @@ -10,6 +10,8 @@ PROG= glxinfo CPPFLAGS+= -I${X11BASE}/include LDADD+= -L${X11BASE}/lib -lGL -lXext -lX11 -lm +obj: _xenocara_obj + .include .include diff --git a/app/ssh-askpass/Makefile b/app/ssh-askpass/Makefile index 5f08c1dba..2d898a0d0 100644 --- a/app/ssh-askpass/Makefile +++ b/app/ssh-askpass/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2006/11/29 11:33:14 matthieu Exp $ +# $OpenBSD: Makefile,v 1.4 2006/12/02 16:28:48 matthieu Exp $ .include X11BASE?= /usr/X11R6 @@ -35,5 +35,7 @@ afterinstall: beforedepend: $(CLASS)_ad.h +obj: _xenocara_obj + .include .include diff --git a/app/wm2/Makefile b/app/wm2/Makefile index e221516e7..c8ddd4b6b 100644 --- a/app/wm2/Makefile +++ b/app/wm2/Makefile @@ -9,5 +9,7 @@ CPPFLAGS+= -I${X11BASE}/include LDADD+= -L${X11BASE}/lib -lXext -lX11 MANDIR= ${X11BASE}/man/cat +obj: _xenocara_obj + .include .include diff --git a/app/xidle/Makefile b/app/xidle/Makefile index f089496e0..9ec0ab9fb 100644 --- a/app/xidle/Makefile +++ b/app/xidle/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1.1.1 2006/11/26 10:57:44 matthieu Exp $ +# $OpenBSD: Makefile,v 1.2 2006/12/02 16:28:48 matthieu Exp $ .include X11BASE?= /usr/X11R6 @@ -11,5 +11,7 @@ LDADD+= -L${X11BASE}/lib -lXss -lXext -lX11 MANDIR= ${X11BASE}/man/cat +obj: _xenocara_obj + .include .include diff --git a/app/xsystrace/Makefile b/app/xsystrace/Makefile index cd01f7ee3..fb3bed68b 100644 --- a/app/xsystrace/Makefile +++ b/app/xsystrace/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2006/11/29 11:33:49 matthieu Exp $ +# $OpenBSD: Makefile,v 1.6 2006/12/02 16:28:48 matthieu Exp $ PROG= xsystrace MAN= xsystrace.1 @@ -19,6 +19,8 @@ afterinstall: X11BASE?= /usr/X11R6 MANDIR= ${X11BASE}/man/cat +obj: _xenocara_obj + .include .include .include diff --git a/app/xvctl/Makefile b/app/xvctl/Makefile index 60522ebbf..6fbca83b9 100644 --- a/app/xvctl/Makefile +++ b/app/xvctl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1.1.1 2006/11/26 10:59:22 matthieu Exp $ +# $OpenBSD: Makefile,v 1.2 2006/12/02 16:28:48 matthieu Exp $ .include X11BASE?= /usr/X11R6 @@ -11,5 +11,7 @@ LDADD+=-L${X11BASE}/lib -lXv -lXext -lX11 MANDIR= ${X11BASE}/man/cat +obj: _xenocara_obj + .include .include diff --git a/lib/expat/Makefile b/lib/expat/Makefile index 2c3e31069..4fd89d273 100644 --- a/lib/expat/Makefile +++ b/lib/expat/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.3 2006/11/29 18:03:09 matthieu Exp $ -# $OpenBSD: Makefile,v 1.3 2006/11/29 18:03:09 matthieu Exp $ +# $OpenBSD: Makefile,v 1.4 2006/12/02 16:28:48 matthieu Exp $ +# $OpenBSD: Makefile,v 1.4 2006/12/02 16:28:48 matthieu Exp $ .include DIST= ${.CURDIR} @@ -23,6 +23,8 @@ includes: ${DIST}/lib/expat_external.h \ ${DESTDIR}${X11BASE}/include/expat_external.h +obj: _xenocara_obj + NOPROFILE= .include diff --git a/lib/freetype/Makefile b/lib/freetype/Makefile index af5825246..d2522f265 100644 --- a/lib/freetype/Makefile +++ b/lib/freetype/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2006/11/29 18:03:09 matthieu Exp $ +# $OpenBSD: Makefile,v 1.5 2006/12/02 16:28:48 matthieu Exp $ FREETYPESRC= ${.CURDIR}/src @@ -18,9 +18,12 @@ CPPFLAGS+= -I${.CURDIR}/include -I${.CURDIR}/src/lzw -DFT2_BUILD_LIBRARY CLEANFILES+= freetype-config freetype2.pc +obj: _xenocara_obj + build: cd ${.CURDIR} && ${MAKE} clean cd ${.CURDIR} && ${SUDO} ${MAKE} includes + cd ${.CURDIR} && ${MAKE} depend cd ${.CURDIR} && ${MAKE} all cd ${.CURDIR} && ${SUDO} ${MAKE} install diff --git a/lib/libGL/Makefile b/lib/libGL/Makefile index 7f148f12b..d5fdbc820 100644 --- a/lib/libGL/Makefile +++ b/lib/libGL/Makefile @@ -390,6 +390,8 @@ x86_xform4.o: matypes.h NOPROFILE= +obj: _xenocara_obj + .include .include diff --git a/lib/libGLU/Makefile b/lib/libGLU/Makefile index 4ddd88beb..7d4224284 100644 --- a/lib/libGLU/Makefile +++ b/lib/libGLU/Makefile @@ -119,8 +119,7 @@ CPPFLAGS+= -I${DIST}/include \ NOPROFILE= -.include -.include +obj: _xenocara_obj includes: @cmp -s ${DIST}/include/GL/glu.h \ @@ -128,6 +127,9 @@ includes: || ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ ${DIST}/include/GL/glu.h ${DESTDIR}${X11BASE}/include/GL +.include +.include + .PATH: ${GLU}/libutil .PATH: ${GLU}/libtess .PATH: ${GLU}/libnurbs/interface diff --git a/lib/libGLw/Makefile b/lib/libGLw/Makefile index 8ddcade56..24777baaa 100644 --- a/lib/libGLw/Makefile +++ b/lib/libGLw/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2006/11/29 18:03:09 matthieu Exp $ +# $OpenBSD: Makefile,v 1.4 2006/12/02 16:28:48 matthieu Exp $ DIST= ${.CURDIR}/../../dist/Mesa GLW= ${DIST}/src/glw @@ -17,6 +17,8 @@ INCS= \ GLwMDrawA.h \ GLwMDrawAP.h +obj: _xenocara_obj + includes: cd ${GLW}; for i in ${INCS}; do \ j="cmp -s $$i ${DESTDIR}${INCSDIR}/GL/$$i || \ diff --git a/share/mk/bsd.xorg.mk b/share/mk/bsd.xorg.mk index 0af5dd627..a3e3737c0 100644 --- a/share/mk/bsd.xorg.mk +++ b/share/mk/bsd.xorg.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.xorg.mk,v 1.7 2006/11/29 21:51:46 matthieu Exp $ -*- makefile -*- +# $OpenBSD: bsd.xorg.mk,v 1.8 2006/12/02 16:28:48 matthieu Exp $ -*- makefile -*- # # Copyright © 2006 Matthieu Herrb # @@ -27,8 +27,8 @@ AUTOCONF_VERSION= 2.59 # Where source lives XENOCARA_TOP?= /usr/xenocara -# Where to buid - not used? -# XORG_BUILDDIR= ${XENOCARA_TOP} +# Where to build +XENOCARA_OBJDIR?= /usr/obj/xenocara # Where to install X11BASE?= /usr/X11R6 @@ -41,7 +41,7 @@ MANDIR= ${X11BASE}/man/cat PKG_CONFIG_PATH= ${X11BASE}/lib/pkgconfig -_cache= --cache-file=${XENOCARA_TOP}/xorg-config.cache.${MACHINE} +_cache= --cache-file=${XENOCARA_OBJDIR}/xorg-config.cache.${MACHINE} MAKE_ENV+= AUTOMAKE_VERSION="$(AUTOMAKE_VERSION)" \ AUTOCONF_VERSION="$(AUTOCONF_VERSION)" \ @@ -70,7 +70,7 @@ all: config.status .if !target(config.status) .if defined(XENOCARA_RERUN_AUTOCONF) && ${XENOCARA_RERUN_AUTOCONF:L} == "yes" -config.status: +config.status: _xenocara_obj cd ${.CURDIR}; ${MAKE_ENV} autoreconf -v --install --force PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \ ${CONFIGURE_ENV} ${.CURDIR}/configure \ @@ -80,7 +80,7 @@ config.status: ${_cache} \ ${CONFIGURE_ARGS} .else -config.status: +config.status: _xenocara_obj PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \ ${CONFIGURE_ENV} ${.CURDIR}/configure --prefix=${X11BASE} \ --sysconfdir=/etc \ @@ -131,4 +131,61 @@ cleandir: clean -@if [ -e Makefile ]; then ${MAKE_ENV} ${MAKE} distclean; fi .endif -.include +# +# Obj dir rules for xenocara +# +.if !target(_xenocara_obj) +. if defined(NOOBJ) +_xenocara_obj: +. else + +. if defined(OBJMACHINE) +__objdir= obj.$(MACHINE) +. else +__objdir= obj +. endif + +. if defined(XENOCARA_OBJMACHINE) +__xobjdir= $(XENOCARA_OBJDIR).$(MACHINE) +__xobjdirpf= +. else +__xobjdir= $(XENOCARA_OBJDIR) +. if defined(OBJMACHINE) +__xobjdirpf= .$(MACHINE) +. else +__xobjdirpf= +. endif +. endif + +_SUBDIRUSE: + +_xenocara_obj! _SUBDIRUSE + @cd $(.CURDIR); \ + here=`/bin/pwd`; xenocara_top=`cd $(XENOCARA_TOP); /bin/pwd`; \ + subdir=$${here#$${xenocara_top}/}; \ + if test $$here != $$subdir ; then \ + dest=${__xobjdir}/$$subdir${__xobjdirpf}; \ + echo "$$here/${__objdir} -> $$dest"; \ + if test ! -L ${__objdir} -o \ + X`readlink ${__objdir}` != X$$dest; then \ + if test -e ${__objdir}; then rm -rf ${__objdir}; fi; \ + ln -sf $$dest ${__objdir}; \ + fi; \ + if test -d ${__xobjdir} -a ! -d $$dest; then \ + mkdir -p $$dest; \ + else \ + true; \ + fi; \ + else \ + dest=$$here/${__objdir}; \ + if test ! -d ${__objdir}; then \ + echo "making $$dest"; \ + mkdir $$dest; \ + fi ; \ + fi +. endif +.endif + +.if !target(obj) +obj: _xenocara_obj +.endif