xref: /freebsd/include/Makefile (revision d3f6a11798fa089bafd550e9a9f62da6956c8cc1)
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD$
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
11FILES=	a.out.h ar.h assert.h bitstring.h complex.h ctype.h db.h \
12	dirent.h disktab.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
25ARPAFILES=	ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h
26
27PROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
28
29MFILES=	float.h floatingpoint.h stdarg.h varargs.h
30
31# posix4/aio.h conflicts with dysons and isn't installed:
32PFILES=	mqueue.h sched.h semaphore.h # aio.h
33
34# Only for default SHARED=copies case
35SFILES=	soundcard.h joystick.h
36
37LFILES=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
38	termios.h ucontext.h
39
40LDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
41	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
42	pccard posix4 sys vm
43
44LNOHEADERDIRS=	fs isofs ufs dev
45
46LSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi \
47	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
48	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
49	ufs/ffs ufs/ufs
50
51# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of
52LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi}
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		${FILES} ${DESTDIR}/usr/include
82	cd ${.CURDIR}/arpa; \
83		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
84		${ARPAFILES} ${DESTDIR}/usr/include/arpa
85	cd ${.CURDIR}/protocols; \
86		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
87		${PROTOFILES} ${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 ${LFILES}
92	ln -sf sys/$i ${DESTDIR}/usr/include/$i
93.endfor
94.for i in ${MFILES}
95	ln -sf machine/$i ${DESTDIR}/usr/include/$i
96.endfor
97.for i in ${PFILES}
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/contrib/ipfilter/netinet)
115	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
116		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
117		${DESTDIR}/usr/include/netinet
118.endif
119.if exists(${.CURDIR}/../sys/security/lomac)
120	cd ${.CURDIR}/../sys/security/lomac; \
121		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 lomac.h \
122		lomacio.h ${DESTDIR}/usr/include/sys
123.endif
124.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
125	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
126		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
127		${DESTDIR}/usr/include/machine
128.endif
129.for i in ${SFILES}
130	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
131.endfor
132
133symlinks:
134	@${ECHO} "Setting up symlinks to kernel source tree..."
135.for i in ${LDIRS}
136	rm -rf ${DESTDIR}/usr/include/$i
137	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
138.endfor
139.for i in ${LNOHEADERDIRS}
140	rm -rf ${DESTDIR}/usr/include/$i
141	mkdir ${DESTDIR}/usr/include/$i
142.endfor
143.for i in ${LSYMSUBDIRS}
144	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
145.endfor
146	rm -rf ${DESTDIR}/usr/include/machine
147	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
148
149.include <bsd.prog.mk>
150