xref: /freebsd/include/Makefile (revision 6901ba93062d02a546a0d2d5d3fe63e2a374a851)
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 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 \
38	dev/an dev/bktr dev/firewire dev/ic dev/iicbus dev/ofw dev/pbio \
39	dev/ppbus dev/smbus dev/usb dev/wi dev/utopia \
40	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
41	fs/nwfs fs/portalfs fs/procfs fs/smbfs fs/udf fs/umapfs \
42	fs/unionfs \
43	geom/concat geom/gate geom/label geom/mirror geom/nop geom/raid3 \
44	geom/shsec geom/stripe \
45	isofs/cd9660 \
46	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
47	netgraph/atm netgraph/netflow \
48	security/mac_biba security/mac_bsdextended security/mac_lomac \
49	security/mac_mls security/mac_partition \
50	ufs/ffs ufs/ufs
51
52.if !defined(NO_BLUETOOTH)
53LSUBSUBDIRS=	netgraph/bluetooth/include
54.endif
55
56# Define SHARED to indicate whether you want symbolic links to the system
57# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
58# probably only useful for developers and should be avoided if you do not
59# wish to tie your /usr/include and /usr/src together.
60#SHARED=	symlinks
61SHARED?=	copies
62
63INCS+=	osreldate.h
64
65osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
66		${.CURDIR}/../sys/sys/param.h \
67		${.CURDIR}/Makefile
68	@${ECHO} creating osreldate.h from newvers.sh
69	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
70	MAKE=${MAKE} . ${.CURDIR}/../sys/conf/newvers.sh;	\
71	echo "$$COPYRIGHT" > osreldate.h;			\
72	echo "#ifdef _KERNEL" >> osreldate.h;			\
73	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
74	echo "#else" >> osreldate.h;				\
75	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
76	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
77	echo "#endif" >> osreldate.h
78
79.for i in ${LHDRS}
80INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
81.endfor
82.for i in ${MHDRS}
83INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
84.endfor
85.for i in ${PHDRS}
86INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
87.endfor
88
89.include <bsd.prog.mk>
90
91installincludes: ${SHARED}
92${SHARED}: compat
93
94# Take care of stale directory-level symlinks.
95compat:
96.for i in ${LDIRS} ${LSUBDIRS} machine crypto
97	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
98		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
99	fi
100.endfor
101	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
102	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
103	    -p ${DESTDIR}${INCLUDEDIR}
104.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
105	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
106	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
107	    -p ${DESTDIR}${INCLUDEDIR}
108.endif
109
110copies:
111.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc
112.if exists(${DESTDIR}${INCLUDEDIR}/$i)
113	cd ${DESTDIR}${INCLUDEDIR}/$i; \
114	for h in *.h; do \
115		if [ -L $$h ]; then rm -f $$h; fi; \
116	done
117.endif
118.endfor
119.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
120	cd ${.CURDIR}/../sys; \
121	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
122	    ${DESTDIR}${INCLUDEDIR}/$i
123.endfor
124	cd ${.CURDIR}/../sys/dev/bktr; \
125	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
126	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
127	cd ${.CURDIR}/../sys/contrib/altq/altq; \
128	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
129	    ${DESTDIR}${INCLUDEDIR}/altq
130	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
131	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
132	    ${DESTDIR}${INCLUDEDIR}/netinet
133	cd ${.CURDIR}/../sys/contrib/pf/net; \
134	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
135	    ${DESTDIR}${INCLUDEDIR}/net
136	cd ${.CURDIR}/../sys/opencrypto; \
137	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
138	    ${DESTDIR}${INCLUDEDIR}/crypto
139	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
140	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
141	    ${DESTDIR}${INCLUDEDIR}/machine
142.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
143	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
144	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
145	    ${DESTDIR}${INCLUDEDIR}/machine/pc
146.endif
147
148symlinks:
149	@${ECHO} "Setting up symlinks to kernel source tree..."
150.for i in ${LDIRS}
151	cd ${.CURDIR}/../sys/$i; \
152	for h in *.h; do \
153		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
154	done
155.endfor
156.for i in ${LSUBDIRS}
157	cd ${.CURDIR}/../sys/$i; \
158	for h in *.h; do \
159		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
160	done
161.endfor
162.for i in ${LSUBSUBDIRS}
163	cd ${.CURDIR}/../sys/$i; \
164	for h in *.h; do \
165		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
166	done
167.endfor
168	cd ${.CURDIR}/../sys/contrib/altq/altq; \
169	for h in *.h; do \
170		ln -fs ../../../sys/contrib/altq/altq/$$h \
171		    ${DESTDIR}${INCLUDEDIR}/altq; \
172	done
173	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
174	for h in *.h; do \
175		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
176		    ${DESTDIR}${INCLUDEDIR}/netinet; \
177	done
178	cd ${.CURDIR}/../sys/contrib/pf/net; \
179	for h in *.h; do \
180		ln -fs ../../../sys/contrib/pf/net/$$h \
181		    ${DESTDIR}${INCLUDEDIR}/net; \
182	done
183	cd ${.CURDIR}/../sys/opencrypto; \
184	for h in *.h; do \
185		ln -fs ../../../sys/opencrypto/$$h \
186		    ${DESTDIR}${INCLUDEDIR}/crypto; \
187	done
188	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
189	for h in *.h; do \
190		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
191		    ${DESTDIR}${INCLUDEDIR}/machine; \
192	done
193.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
194	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
195	for h in *.h; do \
196		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
197		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
198	done
199.endif
200