xref: /freebsd/include/Makefile (revision a220d00e74dd245b4fca59c5eca0c53963686325)
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 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.if defined(WANT_CSRG_LIBM)
25FILES+=	math.h
26.endif
27
28ARPAFILES=	ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h
29
30PROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
31
32MFILES=	float.h floatingpoint.h stdarg.h varargs.h
33
34# posix4/aio.h conflicts with dysons and isn't installed:
35PFILES=	mqueue.h sched.h semaphore.h # aio.h
36
37# Only for default SHARED=copies case
38SFILES=	soundcard.h joystick.h
39
40LFILES=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
41	termios.h ucontext.h
42
43LDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
44	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
45	pccard posix4 sys vm
46
47LNOHEADERDIRS=	fs isofs ufs dev
48
49LSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi \
50	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
51	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
52	ufs/ffs ufs/ufs
53
54# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of
55LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi}
56
57# Define SHARED to indicate whether you want symbolic links to the system
58# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
59# probably only useful for developers and should be avoided if you do not
60# wish to tie your /usr/include and /usr/src together.
61#SHARED=	symlinks
62SHARED?=	copies
63
64all:	osreldate.h
65
66osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
67		${.CURDIR}/../sys/sys/param.h \
68		${.CURDIR}/Makefile
69	@${ECHO} creating osreldate.h from newvers.sh
70	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
71	. ${.CURDIR}/../sys/conf/newvers.sh;			\
72	echo "$$COPYRIGHT" > osreldate.h;			\
73	echo "#ifdef _KERNEL" >> osreldate.h;			\
74	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
75	echo "#else" >> osreldate.h;				\
76	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
77	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
78	echo "#endif" >> osreldate.h
79
80beforeinstall: ${SHARED}
81	@rm -f ${DESTDIR}/usr/include/timepps.h
82	cd ${.CURDIR}; \
83		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
84		${FILES} ${DESTDIR}/usr/include
85	cd ${.CURDIR}/arpa; \
86		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
87		${ARPAFILES} ${DESTDIR}/usr/include/arpa
88	cd ${.CURDIR}/protocols; \
89		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
90		${PROTOFILES} ${DESTDIR}/usr/include/protocols
91	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
92		${.OBJDIR}/osreldate.h \
93		${DESTDIR}/usr/include
94.for i in ${LFILES}
95	ln -sf sys/$i ${DESTDIR}/usr/include/$i
96.endfor
97.for i in ${MFILES}
98	ln -sf machine/$i ${DESTDIR}/usr/include/$i
99.endfor
100.for i in ${PFILES}
101	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
102.endfor
103
104copies:
105.for i in ${LDIRS} ${LSYMSUBDIRS} machine
106	if [ -h ${DESTDIR}/usr/include/$i ]; then \
107		rm -f ${DESTDIR}/usr/include/$i; \
108	fi
109.endfor
110	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
111		-p ${DESTDIR}/usr/include
112.for i in ${LDIRS} ${LSUBDIRS}
113	cd ${.CURDIR}/../sys; \
114		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
115		${DESTDIR}/usr/include/$i
116.endfor
117.if exists(${.CURDIR}/../sys/contrib/ipfilter/netinet)
118	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
119		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
120		${DESTDIR}/usr/include/netinet
121.endif
122.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
123	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
124		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
125		${DESTDIR}/usr/include/machine
126.endif
127.for i in ${SFILES}
128	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
129.endfor
130
131symlinks:
132	@${ECHO} "Setting up symlinks to kernel source tree..."
133.for i in ${LDIRS}
134	rm -rf ${DESTDIR}/usr/include/$i
135	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
136.endfor
137.for i in ${LNOHEADERDIRS}
138	rm -rf ${DESTDIR}/usr/include/$i
139	mkdir ${DESTDIR}/usr/include/$i
140.endfor
141.for i in ${LSYMSUBDIRS}
142	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
143.endfor
144	rm -rf ${DESTDIR}/usr/include/machine
145	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
146
147.include <bsd.prog.mk>
148