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