Makefile revision 2332351c
1#	$NetBSD: Makefile,v 1.36 2003/02/04 18:57:34 matt Exp $
2#
3# Targets & Variables
4#
5# build: Clean out xsrc, and build and install everything that goes
6#	under /usr/X11R6.
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.
14#
15#  DESTDIR -- Same as for build. Mandatory for building a release.
16#  RELEASEDIR -- As explained above.
17#  BUILD_DONE -- If set, assume build is already done.
18#  INSTALL_DONE -- If set, assume binaries to tar up are to be found
19#	in ${DESTDIR} already.
20#  NETBSDSRCDIR -- Set to the full path to the main source tree, /usr/src
21#	by default. Needed to find ./distrib/sets.
22#
23# cleandir distclean: Remove all generated files from under xsrc.
24#
25# clean: Remove object files, but keep imake generated makefiles.
26
27.include <bsd.own.mk>
28
29# Backwards compatibility with NetBSD 1.5 and 1.5.x where NETBSDSRCDIR
30# doesn't get defined by  "bsd.own.mk".
31NETBSDSRCDIR?=	${BSDSRCDIR}
32
33.if defined(USE_XF86_4) && (${USE_XF86_4} != no)
34XCDIR=	xfree/xc
35.else
36XCDIR=	xc
37.endif
38
39.MAIN: all
40.if defined(USE_XF86_4) && (${USE_XF86_4} != no)
41all: all-xc all-local
42.else
43all: all-xc all-contrib all-local
44.endif
45
46all-xc:
47.if exists(${XCDIR}/xmakefile) && defined(UPDATE)
48	@cd ${XCDIR} && ${MAKE} Everything
49.else
50	@-rm -f ${XCDIR}/xmakefile
51	@cd ${XCDIR} && ${MAKE} World
52.endif
53
54all-contrib:
55	@if [ ! -f contrib/Makefile ]; then \
56	  cd contrib && PATH=../${XCDIR}/config/imake:$$PATH \
57	    sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \
58	       ${.CURDIR}/contrib; \
59	fi
60	@cd contrib && ${MAKE}
61
62all-local:
63	@if [ ! -f local/Makefile ]; then \
64	  cd local && PATH=../${XCDIR}/config/imake:$$PATH \
65	    sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \
66	      ${.CURDIR}/local; \
67	fi
68	@cd local && ${MAKE}
69
70.if defined(USE_XF86_4) && (${USE_XF86_4} != no)
71install: install-xc install-local
72.else
73install: install-xc install-contrib install-local
74.endif
75
76install-xc:
77	@cd ${XCDIR} && \
78	  ${MAKE} DESTDIR="${DESTDIR}" install && \
79	  ${MAKE} DESTDIR="${DESTDIR}" install.man
80
81install-contrib:
82	@cd contrib && \
83	  ${MAKE} DESTDIR="${DESTDIR}" install && \
84	  ${MAKE} DESTDIR="${DESTDIR}" install.man
85
86install-local:
87	@cd local && \
88	  ${MAKE} DESTDIR="${DESTDIR}" install && \
89	  ${MAKE} DESTDIR="${DESTDIR}" install.man
90
91clean:
92.if defined(USE_XF86_4) && (${USE_XF86_4} != no)
93	@-cd ${XCDIR} && ${MAKE} clean
94	@-cd local && ${MAKE} clean
95.else
96	@-cd ${XCDIR} && ${MAKE} clean
97	@-cd contrib && ${MAKE} clean
98	@-cd local && ${MAKE} clean
99.endif
100
101cleandir distclean: clean
102	find ${XCDIR} contrib local -name .depend | xargs rm
103	find ${XCDIR} contrib local -name 'Makefile*' | \
104	    xargs grep -l "Makefile generated by imake" | xargs rm
105	-rmdir ${XCDIR}/exports
106	rm -f ${XCDIR}/xmakefile
107
108build:
109.if defined(UPDATE)
110	@${MAKE} all && ${MAKE} install
111.else
112	@${MAKE} cleandir && ${MAKE} all && ${MAKE} install
113.endif
114
115# release goo
116#
117.if !defined(DESTDIR)
118release snapshot:
119	@echo setenv DESTDIR before doing that!
120	@false
121.elif !defined(RELEASEDIR)
122release snapshot:
123	@echo setenv RELEASEDIR before doing that!
124	@false
125#
126.else
127#
128.if defined(INSTALL_DONE)
129release snapshot:
130.elif defined(BUILD_DONE)
131release snapshot: install
132.else
133release snapshot: build
134#
135.endif # INSTALL_DONE or BUILD_DONE
136#
137	${INSTALL} -d -m 755 -o root -g wheel ${RELEASEDIR}/${MACHINE}/binary/sets
138.if (${MACHINE} == "amiga") && !(defined(USE_XF86_4) && (${USE_XF86_4} != no))
139	cd ${XCDIR}/programs/Xserver/hw/netbsd/amiga && \
140		${INSTALL} -c -m 644 INSTALL.X11 ${RELEASEDIR}/${MACHINE}
141.endif
142.if defined(METALOG.add) && !exists(${DESTDIR}/etc)
143	cd ${NETBSDSRCDIR}/distrib/sets && \
144	    sh ./maketars -x -d ${DESTDIR:S,^$,/,} -N ${NETBSDSRCDIR}/etc -t ${RELEASEDIR}/${MACHINE}/binary/sets
145.else
146	cd ${NETBSDSRCDIR}/distrib/sets && \
147	    sh ./maketars -x -d ${DESTDIR:S,^$,/,} -t ${RELEASEDIR}/${MACHINE}/binary/sets
148.endif
149	cd ${RELEASEDIR}/${MACHINE}/binary/sets && \
150		cksum -o 1 *.tgz >BSDSUM && \
151		cksum *.tgz >CKSUM && \
152		cksum -m *.tgz >MD5 && \
153		cksum -o 2 *.tgz >SYSVSUM
154#
155.endif # DESTDIR and RELEASEDIR check
156