Makefile revision 1.34 1 # $NetBSD: Makefile,v 1.34 2002/12/25 22:01: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 # NETBSDSRCDIR -- 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 # Backwards compatibility with NetBSD 1.5 and 1.5.x where NETBSDSRCDIR
30 # doesn't get defined by "bsd.own.mk".
31 NETBSDSRCDIR?= ${BSDSRCDIR}
32
33 .if defined(USE_XF86_4) && (${USE_XF86_4} != no)
34 XCDIR= xfree/xc
35 .else
36 XCDIR= xc
37 .endif
38
39 .MAIN: all
40 .if defined(USE_XF86_4) && (${USE_XF86_4} != no)
41 all: all-xc all-local
42 .else
43 all: all-xc all-contrib all-local
44 .endif
45
46 all-xc:
47 .if exists(${XCDIR}/xmakefile) && defined(UPDATE)
48 @cd ${XCDIR} && ${MAKE} Everything
49 .else
50 @-rm -f ${XCDIR}/xmakefile
51 @cd ${XCDIR} && ${MAKE} World
52 .endif
53
54 all-contrib:
55 @if [ ! -f contrib/Makefile ]; then \
56 cd contrib && PATH=../${XCDIR}/config/imake:$$PATH \
57 sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \
58 ${.CURDIR}/contrib; \
59 fi
60 @cd contrib && ${MAKE}
61
62 all-local:
63 @if [ ! -f local/Makefile ]; then \
64 cd local && PATH=../${XCDIR}/config/imake:$$PATH \
65 sh ../${XCDIR}/config/util/xmkmf -a ../${XCDIR} \
66 ${.CURDIR}/local; \
67 fi
68 @cd local && ${MAKE}
69
70 .if defined(USE_XF86_4) && (${USE_XF86_4} != no)
71 install: install-xc install-local
72 .else
73 install: install-xc install-contrib install-local
74 .endif
75
76 install-xc:
77 @cd ${XCDIR} && \
78 ${MAKE} DESTDIR="${DESTDIR}" install && \
79 ${MAKE} DESTDIR="${DESTDIR}" install.man
80
81 install-contrib:
82 @cd contrib && \
83 ${MAKE} DESTDIR="${DESTDIR}" install && \
84 ${MAKE} DESTDIR="${DESTDIR}" install.man
85
86 install-local:
87 @cd local && \
88 ${MAKE} DESTDIR="${DESTDIR}" install && \
89 ${MAKE} DESTDIR="${DESTDIR}" install.man
90
91 clean:
92 .if defined(USE_XF86_4) && (${USE_XF86_4} != no)
93 @-cd ${XCDIR} && ${MAKE} clean
94 @-cd local && ${MAKE} clean
95 .else
96 @-cd ${XCDIR} && ${MAKE} clean
97 @-cd contrib && ${MAKE} clean
98 @-cd local && ${MAKE} clean
99 .endif
100
101 cleandir distclean: clean
102 find ${XCDIR} contrib local -name .depend | xargs rm
103 find ${XCDIR} contrib local -name 'Makefile*' | \
104 xargs grep -l "Makefile generated by imake" | xargs rm
105 -rmdir ${XCDIR}/exports
106 rm -f ${XCDIR}/xmakefile
107
108 build:
109 .if defined(UPDATE)
110 @${MAKE} all && ${MAKE} install
111 .else
112 @${MAKE} cleandir && ${MAKE} all && ${MAKE} install
113 .endif
114
115 # release goo
116 #
117 .if !defined(DESTDIR)
118 release snapshot:
119 @echo setenv DESTDIR before doing that!
120 @false
121 .elif !defined(RELEASEDIR)
122 release snapshot:
123 @echo setenv RELEASEDIR before doing that!
124 @false
125 #
126 .else
127 #
128 .if defined(INSTALL_DONE)
129 release snapshot:
130 .elif defined(BUILD_DONE)
131 release snapshot: install
132 .else
133 release snapshot: build
134 #
135 .endif # INSTALL_DONE or BUILD_DONE
136 #
137 ${INSTALL} -d -m 755 -o root -g wheel ${RELEASEDIR}/binary/sets
138 .if (${MACHINE} == "amiga") && !(defined(USE_XF86_4) && (${USE_XF86_4} != no))
139 cd ${XCDIR}/programs/Xserver/hw/netbsd/amiga && \
140 ${INSTALL} -c -m 644 INSTALL.X11 ${RELEASEDIR}
141 .endif
142 .if defined(METALOG) && !exists(${DESTDIR}/etc)
143 cd ${NETBSDSRCDIR}/distrib/sets && \
144 sh ./maketars -x -d ${DESTDIR:S,^$,/,} -N ${NETBSDSRCDIR}/etc -t ${RELEASEDIR}/binary/sets
145 .else
146 cd ${NETBSDSRCDIR}/distrib/sets && \
147 sh ./maketars -x -d ${DESTDIR:S,^$,/,} -t ${RELEASEDIR}/binary/sets
148 .endif
149 cd ${RELEASEDIR}/binary/sets && \
150 cksum -o 1 *.tgz >BSDSUM && \
151 cksum *.tgz >CKSUM && \
152 cksum -m *.tgz >MD5 && \
153 cksum -o 2 *.tgz >SYSVSUM
154 #
155 .endif # DESTDIR and RELEASEDIR check
156