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