Makefile revision 54c4591a
1#	$NetBSD: Makefile,v 1.27 2001/05/23 12:47:13 fredb 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
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} && \
66	  ${MAKE} DESTDIR="${DESTDIR}" install && \
67	  ${MAKE} DESTDIR="${DESTDIR}" install.man
68
69install-contrib:
70	@cd contrib && \
71	  ${MAKE} DESTDIR="${DESTDIR}" install && \
72	  ${MAKE} DESTDIR="${DESTDIR}" install.man
73
74install-local:
75	@cd local && \
76	  ${MAKE} DESTDIR="${DESTDIR}" install && \
77	  ${MAKE} DESTDIR="${DESTDIR}" install.man
78
79clean:
80	@-cd ${XCDIR} && ${MAKE} clean
81	@-cd contrib && ${MAKE} clean
82	@-cd local && ${MAKE} clean
83
84cleandir distclean: clean
85	find ${XCDIR} contrib local -name .depend | xargs rm
86	find ${XCDIR} contrib local -name 'Makefile*' | \
87	    xargs grep -l "Makefile generated by imake" | xargs rm
88	-rmdir ${XCDIR}/exports
89	rm -f ${XCDIR}/xmakefile
90
91build:
92.if defined(UPDATE)
93	@${MAKE} all install
94.else
95	@${MAKE} cleandir all install
96.endif
97
98# release goo
99#
100.if !defined(DESTDIR)
101release snapshot:
102	@echo setenv DESTDIR before doing that!
103	@false
104.elif !defined(RELEASEDIR)
105release snapshot:
106	@echo setenv RELEASEDIR before doing that!
107	@false
108#
109.else
110#
111.if defined(INSTALL_DONE)
112release snapshot:
113.elif defined(BUILD_DONE)
114release snapshot: install
115.else
116release snapshot: build
117#
118.endif # INSTALL_DONE or BUILD_DONE
119#
120	${INSTALL} -d -m 755 -o root -g wheel ${RELEASEDIR}/binary/sets
121.if (${MACHINE} == "amiga") && !(defined(USE_XF86_4) && (${USE_XF86_4} != no))
122	cd ${XCDIR}/programs/Xserver/hw/netbsd/amiga && \
123		${INSTALL} -c -m 644 INSTALL.X11 ${RELEASEDIR}
124.endif
125	sh ${BSDSRCDIR}/distrib/sets/maketars -x -s ${BSDSRCDIR}/distrib/sets \
126		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
127	cd ${RELEASEDIR}/binary/sets && \
128		cksum -o 1 *.tgz >BSDSUM && \
129		cksum *.tgz >CKSUM && \
130		cksum -m *.tgz >MD5 && \
131		cksum -o 2 *.tgz >SYSVSUM
132#
133.endif # DESTDIR and RELEASEDIR check
134