summaryrefslogtreecommitdiff
path: root/Makefile
blob: 7b87d10de600b58925372abe9e3455078982d720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# $OpenBSD: Makefile,v 1.21 2007/06/11 15:27:51 todd Exp $
.include <bsd.own.mk>

LOCALAPPD=/usr/local/lib/X11/app-defaults
LOCALAPPX=/usr/local/lib/X11
REALAPPD=/etc/X11/app-defaults
XCONFIG=${XSRCDIR}/etc/X11.${MACHINE}/xorg.conf
RM?=rm

SUBDIR= proto data/bitmaps lib app data/xkbdata xserver driver util doc
.ifndef NOFONTS
SUBDIR+= font
.endif
SUBDIR+= distrib/notes

NOOBJ=

build: beforebuild _SUBDIRUSE

bootstrap:
	${SUDO} ${MAKE} distrib-dirs
	cd ${.CURDIR}/share/mk \
		&& exec ${SUDO} ${MAKE} X11BASE=${X11BASE} install

beforebuild: bootstrap
	cd ${.CURDIR}/util/macros \
		&& ${MAKE} -f Makefile.bsd-wrapper \
		&& exec ${SUDO} ${MAKE} -f Makefile.bsd-wrapper install
	exec ${SUDO} ${MAKE} includes

beforeinstall:
	${MAKE} distrib-dirs
	${MAKE} includes

afterinstall: 
	${MAKE} install-mk
	${MAKE} fix-appd
	/usr/libexec/makewhatis ${DESTDIR}/usr/X11R6/man

realinstall: _SUBDIRUSE

install-mk:
.if defined(DESTDIR) && (${DESTDIR} != "" || ${DESTDIR} != "/")
	cd ${.CURDIR}/share/mk \
		&& ${MAKE} X11BASE=${X11BASE} install
.endif

fix-appd:
	# Make sure /usr/local/lib/X11/app-defaults is a link
	if [ ! -L $(DESTDIR)${LOCALAPPD} ]; then \
	    if [ -d $(DESTDIR)${LOCALAPPD} ]; then \
		mv $(DESTDIR)${LOCALAPPD}/* $(DESTDIR)${REALAPPD}; \
		rmdir $(DESTDIR)${LOCALAPPD}; \
	    fi; \
	    mkdir -p ${DESTDIR}${LOCALAPPX}; \
	    ln -s ${REALAPPD} ${DESTDIR}${LOCALAPPD}; \
	fi

release: release-clean distrib-dirs release-install dist

release-clean:
.if ! ( defined(DESTDIR) && defined(RELEASEDIR) )
	@echo You must set DESTDIR and RELEASEDIR for a release.; exit 255
.endif
	${RM} -rf ${DESTDIR}/usr/X11R6/* ${DESTDIR}/usr/X11R6/.[a-zA-Z0-9]*
	${RM} -rf ${DESTDIR}/var/cache/*
	${RM} -rf ${DESTDIR}/etc/X11/*
	${RM} -rf ${DESTDIR}/etc/fonts/*
	@if [ -d ${DESTDIR}/usr/X11R6 ] && [ "`cd ${DESTDIR}/usr/X11R6;ls`" ]; then \
		echo "Files found in ${DESTDIR}/usr/X11R6:"; \
		(cd ${DESTDIR}/usr/X11R6;/bin/pwd;ls -a); \
		echo "Cleanup before proceeding."; \
		exit 255; \
	fi

release-install:
	@${MAKE} install
.if ${MACHINE} == alpha || ${MACHINE} == hp300 || ${MACHINE} == mac68k || \
    ${MACHINE} == macppc || ${MACHINE} == sparc || ${MACHINE} == vax || \
    ${MACHINE} == zaurus
	@if [ -f $(DESTDIR)/etc/X11/xorg.conf ]; then \
	 echo "Not overwriting existing" $(DESTDIR)/etc/X11/xorg.conf; \
	else set -x; \
	 ${INSTALL} ${INSTALL_COPY} -o root -g wheel -m 644 \
		${XCONFIG} ${DESTDIR}/etc/X11 ; \
	fi
.endif

dist-rel:
	${MAKE} RELEASEDIR=`pwd`/rel DESTDIR=`pwd`/dest dist 2>&1 | tee distlog

dist:
	cd distrib/sets && \
		env MACHINE=${MACHINE} ksh ./maketars ${OSrev} ${OSREV} && \
		(env MACHINE=${MACHINE} ksh ./checkflist ${OSREV} || true)


distrib-dirs:
	if [ ! -d ${DESTDIR}${X11BASE}/. ]; then \
		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}${X11BASE}/; \
	fi
	mtree -qdef ${.CURDIR}/etc/mtree/BSD.x11.dist \
		-p ${DESTDIR}${X11BASE}/ -U
	if [ ! -d ${DESTDIR}${X11ETC}/. ]; then \
		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}${X11ETC}/; \
	fi
	mtree -qdef ${.CURDIR}/etc/mtree/BSD.etc-x11.dist \
		-p ${DESTDIR}${X11ETC}/ -U

.PHONY: all build beforeinstall install afterinstall release clean cleandir \
	dist distrib-dirs fix-appd

.include <bsd.subdir.mk>
.include <bsd.xorg.mk>