Makefile revision 93584
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 93584 2002-04-01 20:20:16Z phk $
3#
4# Doing a make install builds /usr/include
5#
6# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
7# links.
8
9CLEANFILES= osreldate.h version vers.c
10SUBDIR= rpcsvc rpc
11HDRS=	a.out.h ar.h assert.h bitstring.h complex.h ctype.h db.h \
12	dirent.h \
13	dlfcn.h elf.h elf-hints.h err.h fnmatch.h fstab.h \
14	fts.h glob.h grp.h \
15	hesiod.h histedit.h ieeefp.h ifaddrs.h inttypes.h iso646.h langinfo.h \
16	libgen.h limits.h link.h locale.h malloc.h memory.h monetary.h mpool.h \
17	ndbm.h netconfig.h netdb.h nl_types.h nlist.h nsswitch.h objformat.h \
18	paths.h pthread.h pthread_np.h pwd.h \
19	ranlib.h readpassphrase.h regex.h regexp.h resolv.h rune.h runetype.h \
20	search.h setjmp.h sgtty.h \
21	signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h strhash.h \
22	string.h stringlist.h strings.h sysexits.h tar.h time.h timers.h \
23	ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
24
25ARPAHDRS=	ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h
26
27PROTOHDRS=	dumprestore.h routed.h rwhod.h talkd.h timed.h
28
29MHDRS=	float.h floatingpoint.h stdarg.h varargs.h
30
31# posix4/aio.h conflicts with dysons and isn't installed:
32PHDRS=	mqueue.h sched.h semaphore.h # aio.h
33
34LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
35	termios.h ucontext.h
36
37LDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
38	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
39	pccard posix4 sys vm
40
41LNOHEADERDIRS=	dev fs isofs security ufs
42
43LSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi dev/an fs/devfs \
44	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
45	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
46	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
47	security/lomac \
48	ufs/ffs ufs/ufs
49
50# For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
51# are taken care of
52LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*}
53
54# Define SHARED to indicate whether you want symbolic links to the system
55# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
56# probably only useful for developers and should be avoided if you do not
57# wish to tie your /usr/include and /usr/src together.
58#SHARED=	symlinks
59SHARED?=	copies
60
61all:	osreldate.h
62
63osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
64		${.CURDIR}/../sys/sys/param.h \
65		${.CURDIR}/Makefile
66	@${ECHO} creating osreldate.h from newvers.sh
67	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
68	. ${.CURDIR}/../sys/conf/newvers.sh;			\
69	echo "$$COPYRIGHT" > osreldate.h;			\
70	echo "#ifdef _KERNEL" >> osreldate.h;			\
71	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
72	echo "#else" >> osreldate.h;				\
73	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
74	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
75	echo "#endif" >> osreldate.h
76
77beforeinstall: ${SHARED}
78	@rm -f ${DESTDIR}/usr/include/timepps.h
79	cd ${.CURDIR}; \
80		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
81		${HDRS} ${DESTDIR}/usr/include
82	cd ${.CURDIR}/arpa; \
83		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
84		${ARPAHDRS} ${DESTDIR}/usr/include/arpa
85	cd ${.CURDIR}/protocols; \
86		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
87		${PROTOHDRS} ${DESTDIR}/usr/include/protocols
88	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
89		${.OBJDIR}/osreldate.h \
90		${DESTDIR}/usr/include
91.for i in ${LHDRS}
92	ln -sf sys/$i ${DESTDIR}/usr/include/$i
93.endfor
94.for i in ${MHDRS}
95	ln -sf machine/$i ${DESTDIR}/usr/include/$i
96.endfor
97.for i in ${PHDRS}
98	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
99.endfor
100
101copies:
102.for i in ${LDIRS} ${LSYMSUBDIRS} machine
103	if [ -h ${DESTDIR}/usr/include/$i ]; then \
104		rm -f ${DESTDIR}/usr/include/$i; \
105	fi
106.endfor
107	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
108		-p ${DESTDIR}/usr/include
109.for i in ${LDIRS} ${LSUBDIRS}
110	cd ${.CURDIR}/../sys; \
111		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
112		${DESTDIR}/usr/include/$i
113.endfor
114.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
115	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
116		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
117		${DESTDIR}/usr/include/machine
118.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
119	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
120		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
121		${DESTDIR}/usr/include/machine/pc
122.endif
123.endif
124
125symlinks:
126	@${ECHO} "Setting up symlinks to kernel source tree..."
127.for i in ${LDIRS}
128	rm -rf ${DESTDIR}/usr/include/$i
129	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
130.endfor
131.for i in ${LNOHEADERDIRS}
132	rm -rf ${DESTDIR}/usr/include/$i
133	mkdir ${DESTDIR}/usr/include/$i
134.endfor
135.for i in ${LSYMSUBDIRS}
136	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
137.endfor
138	rm -rf ${DESTDIR}/usr/include/machine
139	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
140
141.include <bsd.prog.mk>
142