Makefile revision 1.42 1 # $NetBSD: Makefile,v 1.42 2004/06/14 16:04:28 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 (NetBSD <=1.6)
14 # or the ${RELEASEDIR}/${MACHINE}/binary/sets directory (NetBSD >1.6).
15 #
16 # DESTDIR -- Same as for build. Mandatory for building a release.
17 # RELEASEDIR -- As explained above.
18 # BUILD_DONE -- If set, assume build is already done.
19 # INSTALL_DONE -- If set, assume binaries to tar up are to be found
20 # in ${DESTDIR} already.
21 # NETBSDSRCDIR -- Set to the full path to the main source tree, /usr/src
22 # by default. Needed to find ./distrib/sets.
23 #
24 # cleandir distclean: Remove all generated files from under xsrc.
25 #
26 # clean: Remove object files, but keep imake generated makefiles.
27
28 .include <bsd.own.mk>
29
30 # Backwards compatibility with NetBSD 1.5 and 1.5.x where NETBSDSRCDIR
31 # doesn't get defined by "bsd.own.mk".
32 NETBSDSRCDIR?= ${BSDSRCDIR}
33
34 .if ${USE_XF86_4:Uno} != "no"
35 XCDIR= xfree/xc
36 .else
37 XCDIR= xc
38 .endif
39
40
41 .MAIN: all
42 .if ${USE_XF86_4:Uno} != "no"
43 all: all-xc all-local
44 .else
45 all: all-xc all-contrib all-local
46 .endif
47
48 all-xc:
49 .if exists(${XCDIR}/xmakefile) && defined(UPDATE)
50 @cd ${XCDIR} && ${MAKE} Everything
51 .else
52 @-rm -f ${XCDIR}/xmakefile
53 @cd ${XCDIR} && ${MAKE} World
54 .endif
55
56 all-contrib:
57 @if [ ! -f contrib/Makefile ]; then \
58 cd contrib && PATH=../${XCDIR}/config/imake:$$PATH \
59 sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \
60 ${.CURDIR}/contrib; \
61 fi
62 @cd contrib && ${MAKE}
63
64 all-local:
65 @if [ ! -f local/Makefile ]; then \
66 cd local && PATH=../${XCDIR}/config/imake:$$PATH \
67 sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \
68 ${.CURDIR}/local; \
69 fi
70 @cd local && ${MAKE}
71
72 .if ${USE_XF86_4:Uno} != "no"
73 install: install-xc install-local
74 .else
75 install: install-xc install-contrib install-local
76 .endif
77
78 install-xc:
79 @cd ${XCDIR} && \
80 ${MAKE} DESTDIR="${DESTDIR}" install && \
81 ${MAKE} DESTDIR="${DESTDIR}" install.man
82
83 install-contrib:
84 @cd contrib && \
85 ${MAKE} DESTDIR="${DESTDIR}" install && \
86 ${MAKE} DESTDIR="${DESTDIR}" install.man
87
88 install-local:
89 @cd local && \
90 ${MAKE} DESTDIR="${DESTDIR}" install && \
91 ${MAKE} DESTDIR="${DESTDIR}" install.man
92
93 clean:
94 .if ${USE_XF86_4:Uno} != "no"
95 @-cd ${XCDIR} && ${MAKE} clean
96 @-cd local && ${MAKE} clean
97 .else
98 @-cd ${XCDIR} && ${MAKE} clean
99 @-cd contrib && ${MAKE} clean
100 @-cd local && ${MAKE} clean
101 .endif
102
103 cleandir distclean: clean
104 find ${XCDIR} contrib local -name .depend | xargs -n5 rm
105 find ${XCDIR} contrib local -name 'Makefile*' | \
106 xargs -n5 grep -l "Makefile generated by imake" | xargs rm
107 -rmdir ${XCDIR}/exports
108 rm -f ${XCDIR}/xmakefile ${XCDIR}/config/cf/version.def \
109 ${XCDIR}/config/cf/date.def
110
111 build:
112 .if defined(UPDATE)
113 @${MAKE} all && ${MAKE} install
114 .else
115 @${MAKE} cleandir && ${MAKE} all && ${MAKE} install
116 .endif
117
118 # release goo
119 #
120 .if !defined(DESTDIR)
121 release snapshot:
122 @echo setenv DESTDIR before doing that!
123 @false
124 .elif !defined(RELEASEDIR)
125 release snapshot:
126 @echo setenv RELEASEDIR before doing that!
127 @false
128 #
129 .else
130 #
131 .if defined(INSTALL_DONE)
132 release snapshot:
133 .elif defined(BUILD_DONE)
134 release snapshot: install
135 .else
136 release snapshot: build
137 #
138 .endif # INSTALL_DONE or BUILD_DONE
139 #
140 ${INSTALL} -d -m 755 -o root -g wheel ${RELEASEDIR}/${MACHINE}/binary/sets
141 .if (${MACHINE} == "amiga") && ${USE_XF86_4:Uno} == "no"
142 cd ${XCDIR}/programs/Xserver/hw/netbsd/amiga && \
143 ${INSTALL} -c -m 644 INSTALL.X11 ${RELEASEDIR}/${MACHINE}
144 .endif
145 ${INSTALL} -d -m 755 -o root -g wheel ${DESTDIR}/etc/mtree
146 .if defined(METALOG.add) && !exists(${DESTDIR}/etc/master.passwd)
147 cd ${NETBSDSRCDIR}/distrib/sets && \
148 sh ./maketars -x -d ${DESTDIR:S,^$,/,} -N ${NETBSDSRCDIR}/etc -t ${RELEASEDIR}/${MACHINE}/binary/sets
149 .else
150 cd ${NETBSDSRCDIR}/distrib/sets && \
151 sh ./maketars -x -d ${DESTDIR:S,^$,/,} -t ${RELEASEDIR}/${MACHINE}/binary/sets
152 .endif
153 cd ${RELEASEDIR}/${MACHINE}/binary/sets && \
154 cksum -o 1 *.tgz >BSDSUM && \
155 cksum *.tgz >CKSUM && \
156 cksum -m *.tgz >MD5 && \
157 cksum -o 2 *.tgz >SYSVSUM
158 #
159 .endif # DESTDIR and RELEASEDIR check
160