xref: /freebsd/include/Makefile (revision 74bf4e164ba5851606a27d4feff27717452583e5)
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD$
3#
4# Doing a "make install" builds /usr/include.
5
6CLEANFILES= osreldate.h version vers.c
7SUBDIR= arpa protocols rpcsvc rpc
8INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
9	db.h \
10	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
11	fts.h ftw.h getopt.h glob.h grp.h \
12	hesiod.h histedit.h ieeefp.h ifaddrs.h \
13	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
14	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
15	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
16	proc_service.h pthread.h \
17	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
18	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
19	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
20	strings.h sysexits.h tar.h tgmath.h \
21	time.h timeconv.h timers.h ttyent.h \
22	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
23	wctype.h wordexp.h
24
25MHDRS=	float.h floatingpoint.h stdarg.h
26
27# posix4/mqueue.h is useless without an implementation and isn't installed:
28PHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
29
30LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
31	termios.h ucontext.h
32
33LDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
34	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
35	pccard posix4 sys vm
36
37LSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
38	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
39	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
40	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs \
41	geom/concat geom/gate geom/label geom/mirror geom/nop geom/raid3 \
42	geom/stripe \
43	isofs/cd9660 netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
44	netgraph/atm security/mac_biba security/mac_bsdextended \
45	security/mac_lomac security/mac_mls security/mac_partition \
46	ufs/ffs ufs/ufs
47
48.if !defined(NO_BLUETOOTH)
49LSUBSUBDIRS=	netgraph/bluetooth/include
50.endif
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
59INCS+=	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 "<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
75.for i in ${LHDRS}
76INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
77.endfor
78.for i in ${MHDRS}
79INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
80.endfor
81.for i in ${PHDRS}
82INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
83.endfor
84
85.include <bsd.prog.mk>
86
87installincludes: ${SHARED}
88${SHARED}: compat
89
90# Take care of stale directory-level symlinks.
91compat:
92.for i in ${LDIRS} ${LSUBDIRS} machine crypto
93	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
94		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
95	fi
96.endfor
97	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
98	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
99	    -p ${DESTDIR}${INCLUDEDIR}
100
101copies:
102.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
103.if exists(${DESTDIR}${INCLUDEDIR}/$i)
104	cd ${DESTDIR}${INCLUDEDIR}/$i; \
105	for h in *.h; do \
106		if [ -L $$h ]; then rm -f $$h; fi; \
107	done
108.endif
109.endfor
110.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
111	cd ${.CURDIR}/../sys; \
112	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
113	    ${DESTDIR}${INCLUDEDIR}/$i
114.endfor
115	cd ${.CURDIR}/../sys/dev/bktr; \
116	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
117	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
118	cd ${.CURDIR}/../sys/contrib/altq/altq; \
119	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
120	    ${DESTDIR}${INCLUDEDIR}/altq
121	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
122	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
123	    ${DESTDIR}${INCLUDEDIR}/netinet
124	cd ${.CURDIR}/../sys/contrib/pf/net; \
125	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
126	    ${DESTDIR}${INCLUDEDIR}/net
127	cd ${.CURDIR}/../sys/opencrypto; \
128	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
129	    ${DESTDIR}${INCLUDEDIR}/crypto
130	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
131	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
132	    ${DESTDIR}${INCLUDEDIR}/machine
133.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
134	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
135	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
136	    ${DESTDIR}${INCLUDEDIR}/machine/pc
137.endif
138
139symlinks:
140	@${ECHO} "Setting up symlinks to kernel source tree..."
141.for i in ${LDIRS}
142	cd ${.CURDIR}/../sys/$i; \
143	for h in *.h; do \
144		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
145	done
146.endfor
147.for i in ${LSUBDIRS}
148	cd ${.CURDIR}/../sys/$i; \
149	for h in *.h; do \
150		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
151	done
152.endfor
153.for i in ${LSUBSUBDIRS}
154	cd ${.CURDIR}/../sys/$i; \
155	for h in *.h; do \
156		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
157	done
158.endfor
159	cd ${.CURDIR}/../sys/contrib/altq/altq; \
160	for h in *.h; do \
161		ln -fs ../../../sys/contrib/altq/altq/$$h \
162		    ${DESTDIR}${INCLUDEDIR}/altq; \
163	done
164	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
165	for h in *.h; do \
166		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
167		    ${DESTDIR}${INCLUDEDIR}/netinet; \
168	done
169	cd ${.CURDIR}/../sys/contrib/pf/net; \
170	for h in *.h; do \
171		ln -fs ../../../sys/contrib/pf/net/$$h \
172		    ${DESTDIR}${INCLUDEDIR}/net; \
173	done
174	cd ${.CURDIR}/../sys/opencrypto; \
175	for h in *.h; do \
176		ln -fs ../../../sys/opencrypto/$$h \
177		    ${DESTDIR}${INCLUDEDIR}/crypto; \
178	done
179	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
180	for h in *.h; do \
181		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
182		    ${DESTDIR}${INCLUDEDIR}/machine; \
183	done
184.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
185	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
186	for h in *.h; do \
187		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
188		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
189	done
190.endif
191