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