Makefile revision bf6f5851
1#	$NetBSD: Makefile,v 1.29 2001/10/14 23:56:18 jwise 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#  BSDSRCDIR -- 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.if defined(USE_XF86_4) && (${USE_XF86_4} != no)
30XCDIR=	xfree/xc
31.else
32XCDIR=	xc
33.endif
34
35.MAIN: all
36.if defined(USE_XF86_4) && (${USE_XF86_4} != no)
37all: all-xc all-local
38.else
39all: all-xc all-contrib all-local
40.endif
41
42all-xc:
43.if exists(${XCDIR}/xmakefile) && defined(UPDATE)
44	@cd ${XCDIR} && ${MAKE} Everything
45.else
46	@-rm -f ${XCDIR}/xmakefile
47	@cd ${XCDIR} && ${MAKE} World
48.endif
49
50all-contrib:
51	@if [ ! -f contrib/Makefile ]; then \
52	  cd contrib && PATH=../${XCDIR}/config/imake:$$PATH \
53	    sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \
54	       ${.CURDIR}/contrib; \
55	fi
56	@cd contrib && ${MAKE}
57
58all-local:
59	@if [ ! -f local/Makefile ]; then \
60	  cd local && PATH=../${XCDIR}/config/imake:$$PATH \
61	    sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \
62	      ${.CURDIR}/local; \
63	fi
64	@cd local && ${MAKE}
65
66.if defined(USE_XF86_4) && (${USE_XF86_4} != no)
67install: install-xc install-local
68.else
69install: install-xc install-contrib install-local
70.endif
71
72install-xc:
73	@cd ${XCDIR} && \
74	  ${MAKE} DESTDIR="${DESTDIR}" install && \
75	  ${MAKE} DESTDIR="${DESTDIR}" install.man
76
77install-contrib:
78	@cd contrib && \
79	  ${MAKE} DESTDIR="${DESTDIR}" install && \
80	  ${MAKE} DESTDIR="${DESTDIR}" install.man
81
82install-local:
83	@cd local && \
84	  ${MAKE} DESTDIR="${DESTDIR}" install && \
85	  ${MAKE} DESTDIR="${DESTDIR}" install.man
86
87clean:
88.if defined(USE_XF86_4) && (${USE_XF86_4} != no)
89	@-cd ${XCDIR} && ${MAKE} clean
90	@-cd local && ${MAKE} clean
91.else
92	@-cd ${XCDIR} && ${MAKE} clean
93	@-cd contrib && ${MAKE} clean
94	@-cd local && ${MAKE} clean
95.endif
96
97cleandir distclean: clean
98	find ${XCDIR} contrib local -name .depend | xargs rm
99	find ${XCDIR} contrib local -name 'Makefile*' | \
100	    xargs grep -l "Makefile generated by imake" | xargs rm
101	-rmdir ${XCDIR}/exports
102	rm -f ${XCDIR}/xmakefile
103
104build:
105.if defined(UPDATE)
106	@${MAKE} all && ${MAKE} install
107.else
108	@${MAKE} cleandir && ${MAKE} all && ${MAKE} install
109.endif
110
111# release goo
112#
113.if !defined(DESTDIR)
114release snapshot:
115	@echo setenv DESTDIR before doing that!
116	@false
117.elif !defined(RELEASEDIR)
118release snapshot:
119	@echo setenv RELEASEDIR before doing that!
120	@false
121#
122.else
123#
124.if defined(INSTALL_DONE)
125release snapshot:
126.elif defined(BUILD_DONE)
127release snapshot: install
128.else
129release snapshot: build
130#
131.endif # INSTALL_DONE or BUILD_DONE
132#
133	${INSTALL} -d -m 755 -o root -g wheel ${RELEASEDIR}/binary/sets
134.if (${MACHINE} == "amiga") && !(defined(USE_XF86_4) && (${USE_XF86_4} != no))
135	cd ${XCDIR}/programs/Xserver/hw/netbsd/amiga && \
136		${INSTALL} -c -m 644 INSTALL.X11 ${RELEASEDIR}
137.endif
138	sh ${BSDSRCDIR}/distrib/sets/maketars -x -s ${BSDSRCDIR}/distrib/sets \
139		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
140	cd ${RELEASEDIR}/binary/sets && \
141		cksum -o 1 *.tgz >BSDSUM && \
142		cksum *.tgz >CKSUM && \
143		cksum -m *.tgz >MD5 && \
144		cksum -o 2 *.tgz >SYSVSUM
145#
146.endif # DESTDIR and RELEASEDIR check
147