Makefile revision ff4f940d
1# $NetBSD: Makefile,v 1.45 2021/11/02 22:09:17 abs Exp $ 2# 3# Targets & Variables 4# 5# build: Clean out xsrc, and build and install everything that goes 6# under /usr/X11R7. 7# 8# DESTDIR -- Set to an alternative directory to install under. 9# UPDATE -- If set, don't make clean first, plus attempt to make 10# only the targets that are out of date. 11# 12# release snapshot: Same as build, plus tar up the X sets and install 13# them under the ${RELEASEDIR}/binary/sets directory (NetBSD <=1.6) 14# or the ${RELEASEDIR}/${MACHINE}/binary/sets directory (NetBSD >1.6). 15# 16# DESTDIR -- Same as for build. Mandatory for building a release. 17# RELEASEDIR -- As explained above. 18# BUILD_DONE -- If set, assume build is already done. 19# INSTALL_DONE -- If set, assume binaries to tar up are to be found 20# in ${DESTDIR} already. 21# NETBSDSRCDIR -- Set to the full path to the main source tree, /usr/src 22# by default. Needed to find ./distrib/sets. 23# 24# cleandir distclean: Remove all generated files from under xsrc. 25# 26# clean: Remove object files, but keep imake generated makefiles. 27 28.include <bsd.own.mk> 29 30# Backwards compatibility with NetBSD 1.5 and 1.5.x where NETBSDSRCDIR 31# doesn't get defined by "bsd.own.mk". 32NETBSDSRCDIR?= ${BSDSRCDIR} 33 34XCDIR= xfree/xc 35 36.MAIN: all 37all: all-xc all-local 38 39all-xc: 40.if exists(${XCDIR}/xmakefile) && defined(UPDATE) 41 @cd ${XCDIR} && ${MAKE} Everything 42.else 43 @-rm -f ${XCDIR}/xmakefile 44 @cd ${XCDIR} && ${MAKE} World 45.endif 46 47all-local: 48 @if [ ! -f local/Makefile ]; then \ 49 cd local && PATH=../${XCDIR}/config/imake:$$PATH \ 50 sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \ 51 ${.CURDIR}/local; \ 52 fi 53 @cd local && ${MAKE} 54 55install: install-xc install-local 56 57install-xc: 58 @cd ${XCDIR} && \ 59 ${MAKE} DESTDIR="${DESTDIR}" install && \ 60 ${MAKE} DESTDIR="${DESTDIR}" install.man 61 62install-local: 63 @cd local && \ 64 ${MAKE} DESTDIR="${DESTDIR}" install && \ 65 ${MAKE} DESTDIR="${DESTDIR}" install.man 66 67clean: 68 @-cd ${XCDIR} && ${MAKE} clean 69 @-cd local && ${MAKE} clean 70 71cleandir distclean: clean 72 find ${XCDIR} local -name .depend | xargs -n5 rm 73 find ${XCDIR} local -name 'Makefile*' | \ 74 xargs -n5 grep -l "Makefile generated by imake" | xargs rm 75 -rmdir ${XCDIR}/exports 76 rm -f ${XCDIR}/xmakefile ${XCDIR}/config/cf/version.def \ 77 ${XCDIR}/config/cf/date.def 78 79build: 80.if defined(UPDATE) 81 @${MAKE} all && ${MAKE} install 82.else 83 @${MAKE} cleandir && ${MAKE} all && ${MAKE} install 84.endif 85 86# release goo 87# 88.if !defined(DESTDIR) 89release snapshot: 90 @echo setenv DESTDIR before doing that! 91 @false 92.elif !defined(RELEASEDIR) 93release snapshot: 94 @echo setenv RELEASEDIR before doing that! 95 @false 96# 97.else 98# 99.if defined(INSTALL_DONE) 100release snapshot: 101.elif defined(BUILD_DONE) 102release snapshot: install 103.else 104release snapshot: build 105# 106.endif # INSTALL_DONE or BUILD_DONE 107# 108 ${INSTALL} -d -m 755 -o root -g wheel ${RELEASEDIR}/${MACHINE}/binary/sets 109 ${INSTALL} -d -m 755 -o root -g wheel ${DESTDIR}/etc/mtree 110.if defined(METALOG.add) && !exists(${DESTDIR}/etc/master.passwd) 111 cd ${NETBSDSRCDIR}/distrib/sets && \ 112 sh ./maketars -x -d ${DESTDIR:S,^$,/,} -N ${NETBSDSRCDIR}/etc -t ${RELEASEDIR}/${MACHINE}/binary/sets 113.else 114 cd ${NETBSDSRCDIR}/distrib/sets && \ 115 sh ./maketars -x -d ${DESTDIR:S,^$,/,} -t ${RELEASEDIR}/${MACHINE}/binary/sets 116.endif 117 cd ${RELEASEDIR}/${MACHINE}/binary/sets && \ 118 cksum -o 1 *.tgz >BSDSUM && \ 119 cksum *.tgz >CKSUM && \ 120 cksum -m *.tgz >MD5 && \ 121 cksum -o 2 *.tgz >SYSVSUM 122# 123.endif # DESTDIR and RELEASEDIR check 124