Makefile revision 93730
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 93730 2002-04-03 17:29:20Z ru $
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
41LSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi dev/an fs/devfs \
42	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
43	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
44	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
45	security/lomac \
46	ufs/ffs ufs/ufs
47
48# For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
49# are taken care of
50LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*}
51
52# Define SHARED to indicate whether you want symbolic links to the system
53# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
54# probably only useful for developers and should be avoided if you do not
55# wish to tie your /usr/include and /usr/src together.
56#SHARED=	symlinks
57SHARED?=	copies
58
59all:	osreldate.h
60
61osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
62		${.CURDIR}/../sys/sys/param.h \
63		${.CURDIR}/Makefile
64	@${ECHO} creating osreldate.h from newvers.sh
65	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
66	. ${.CURDIR}/../sys/conf/newvers.sh;			\
67	echo "$$COPYRIGHT" > osreldate.h;			\
68	echo "#ifdef _KERNEL" >> osreldate.h;			\
69	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
70	echo "#else" >> osreldate.h;				\
71	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
72	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
73	echo "#endif" >> osreldate.h
74
75beforeinstall: ${SHARED}
76	@rm -f ${DESTDIR}/usr/include/timepps.h
77	cd ${.CURDIR}; \
78		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
79		${HDRS} ${DESTDIR}/usr/include
80	cd ${.CURDIR}/arpa; \
81		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
82		${ARPAHDRS} ${DESTDIR}/usr/include/arpa
83	cd ${.CURDIR}/protocols; \
84		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
85		${PROTOHDRS} ${DESTDIR}/usr/include/protocols
86	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
87		${.OBJDIR}/osreldate.h \
88		${DESTDIR}/usr/include
89.for i in ${LHDRS}
90	ln -sf sys/$i ${DESTDIR}/usr/include/$i
91.endfor
92.for i in ${MHDRS}
93	ln -sf machine/$i ${DESTDIR}/usr/include/$i
94.endfor
95.for i in ${PHDRS}
96	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
97.endfor
98
99copies:
100.for i in ${LDIRS} ${LSYMSUBDIRS} machine
101	if [ -h ${DESTDIR}/usr/include/$i ]; then \
102		rm -f ${DESTDIR}/usr/include/$i; \
103	fi
104.endfor
105	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
106		-p ${DESTDIR}/usr/include
107.for i in ${LDIRS} ${LSUBDIRS}
108	cd ${.CURDIR}/../sys; \
109		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
110		${DESTDIR}/usr/include/$i
111.endfor
112.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
113	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
114		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
115		${DESTDIR}/usr/include/machine
116.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
117	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
118		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
119		${DESTDIR}/usr/include/machine/pc
120.endif
121.endif
122
123symlinks:
124	@${ECHO} "Setting up symlinks to kernel source tree..."
125.for i in ${LDIRS}
126	rm -rf ${DESTDIR}/usr/include/$i
127	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
128.endfor
129.for i in ${LSYMSUBDIRS}
130	rm -rf ${DESTDIR}/usr/include/$i
131	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
132.endfor
133	rm -rf ${DESTDIR}/usr/include/machine
134	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
135
136.include <bsd.prog.mk>
137