Makefile revision b1c0e358
1#	$NetBSD: Makefile,v 1.9 1999/12/28 19:51:54 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
27BSDSRCDIR?=	/usr/src
28
29all: all-xc all-contrib
30
31all-xc:
32.if exists(xc/xmakefile) && defined(UPDATE)
33	@cd xc && ${MAKE} Everything
34.else
35	@-rm -f xc/xmakefile
36	@cd xc && ${MAKE} World
37.endif
38
39all-contrib:
40	@if [ ! -f contrib/Makefile ]; then \
41	  cd contrib && PATH=../xc/config/imake:$$PATH \
42	    sh ../xc/config/util/xmkmf -a ../xc ../contrib; \
43	fi
44	@cd contrib && ${MAKE}
45
46install: install-xc install-contrib
47
48install-xc:
49	@cd xc && ${MAKE} install && ${MAKE} install.man
50
51install-contrib:
52	@cd contrib && ${MAKE} install && ${MAKE} install.man
53
54clean:
55	@-cd xc && ${MAKE} clean
56	@-cd contrib && ${MAKE} clean
57
58cleandir distclean: clean
59	find xc contrib -name .depend | xargs rm
60	find xc contrib -name 'Makefile*' | \
61	xargs grep -l "Makefile generated by imake" | xargs rm
62	-rmdir xc/exports
63	rm -f xc/xmakefile
64
65build:
66.if defined(UPDATE)
67	@${MAKE} all install
68.else
69	@${MAKE} cleandir all install
70.endif
71
72# release goo
73#
74.if !defined(DESTDIR)
75release snapshot:
76	@echo setenv DESTDIR before doing that!
77	@false
78.elif !defined(RELEASEDIR)
79release snapshot:
80	@echo setenv RELEASEDIR before doing that!
81	@false
82#
83.else
84#
85.if defined(INSTALL_DONE)
86release snapshot:
87.elif defined(BUILD_DONE)
88release snapshot: install
89.else
90release snapshot: build
91#
92.endif # INSTALL_DONE or BUILD_DONE
93#
94	${INSTALL} -d -m 755 -o root -g wheel ${RELEASEDIR}/binary/sets
95	sh ${BSDSRCDIR}/distrib/sets/maketars -x -s ../src/distrib/sets \
96		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
97	cd ${RELEASEDIR}/binary/sets && \
98		cksum -o 1 *.tgz >BSDSUM && \
99		cksum *.tgz >CKSUM && \
100		cksum -m *.tgz >MD5 && \
101		cksum -o 2 *.tgz >SYSVSUM
102#
103.endif # maketars exists and DESTDIR and RELEASEDIR check
104
105.include "/etc/mk.conf"
106