xref: /freebsd/include/Makefile (revision e1fe3dba5ce2826061f6489765be9b4a341736a9)
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD$
3#
4# Doing a "make install" builds /usr/include.
5
6.include <bsd.own.mk>
7
8CLEANFILES= osreldate.h version vers.c
9SUBDIR= arpa gssapi protocols rpcsvc rpc
10INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
11	db.h \
12	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13	fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
14	histedit.h ieeefp.h ifaddrs.h \
15	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
16	locale.h malloc.h memory.h monetary.h mpool.h mqueue.h \
17	ndbm.h netconfig.h \
18	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
19	printf.h proc_service.h pthread.h \
20	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
21	resolv.h runetype.h search.h setjmp.h sgtty.h \
22	signal.h stab.h \
23	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
24	strings.h sysexits.h tar.h tgmath.h \
25	time.h timeconv.h timers.h ttyent.h \
26	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
27	wctype.h wordexp.h
28
29MHDRS=	float.h floatingpoint.h stdarg.h
30
31PHDRS=	sched.h semaphore.h _semaphore.h
32
33LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
34	termios.h ucontext.h
35
36LDIRS=	bsm cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
37	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
38	pccard posix4 sys vm
39
40LSUBDIRS=	cam/scsi \
41	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
42	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
43	dev/pbio dev/ppbus dev/smbus dev/speaker dev/usb dev/wi dev/utopia \
44	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
45	fs/nwfs fs/portalfs fs/procfs fs/smbfs fs/udf fs/umapfs \
46	fs/unionfs \
47	geom/concat geom/eli geom/gate geom/label geom/mirror geom/nop \
48	geom/raid3 geom/shsec geom/stripe \
49	isofs/cd9660 \
50	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
51	netgraph/atm netgraph/netflow \
52	security/mac_biba security/mac_bsdextended security/mac_lomac \
53	security/mac_mls security/mac_partition \
54	ufs/ffs ufs/ufs
55
56.if ${MK_GPIB} != "no"
57_dev_ieee488=	dev/ieee488
58.endif
59
60.if ${MK_HESIOD} != "no"
61INCS+=	hesiod.h
62.endif
63
64.if ${MK_BLUETOOTH} != "no"
65LSUBSUBDIRS=	netgraph/bluetooth/include
66.endif
67
68# Define SHARED to indicate whether you want symbolic links to the system
69# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
70# probably only useful for developers and should be avoided if you do not
71# wish to tie your /usr/include and /usr/src together.
72#SHARED=	symlinks
73SHARED?=	copies
74
75INCS+=	osreldate.h
76
77osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
78    ${.CURDIR}/Makefile
79	@${ECHO} creating osreldate.h from newvers.sh
80	@MAKE=${MAKE}; \
81	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
82	. ${.CURDIR}/../sys/conf/newvers.sh; \
83	echo "$$COPYRIGHT" > osreldate.h; \
84	echo "#ifdef _KERNEL" >> osreldate.h; \
85	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
86	echo "#else" >> osreldate.h; \
87	echo "#undef __FreeBSD_version" >> osreldate.h; \
88	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
89	echo "#endif" >> osreldate.h
90
91.for i in ${LHDRS}
92INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
93.endfor
94.for i in ${MHDRS}
95INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
96.endfor
97.for i in ${PHDRS}
98INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
99.endfor
100
101.if ${MACHINE} != ${MACHINE_ARCH}
102_MARCH=${MACHINE_ARCH}
103.endif
104
105.include <bsd.prog.mk>
106
107installincludes: ${SHARED}
108${SHARED}: compat
109
110# Take care of stale directory-level symlinks.
111compat:
112.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
113	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
114		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
115	fi
116.endfor
117	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
118	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
119	    -p ${DESTDIR}${INCLUDEDIR}
120.if ${MK_BIND_LIBS} != "no"
121	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
122	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
123	    -p ${DESTDIR}${INCLUDEDIR}
124.endif
125
126copies:
127.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
128	${_MARCH}
129.if exists(${DESTDIR}${INCLUDEDIR}/$i)
130	cd ${DESTDIR}${INCLUDEDIR}/$i; \
131	for h in *.h; do \
132		if [ -L $$h ]; then rm -f $$h; fi; \
133	done
134.endif
135.endfor
136.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
137	cd ${.CURDIR}/../sys; \
138	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
139	    ${DESTDIR}${INCLUDEDIR}/$i
140.endfor
141	cd ${.CURDIR}/../sys/dev/acpica; \
142	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
143	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
144	cd ${.CURDIR}/../sys/dev/bktr; \
145	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
146	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
147	cd ${.CURDIR}/../sys/contrib/altq/altq; \
148	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
149	    ${DESTDIR}${INCLUDEDIR}/altq
150.if ${MK_IPFILTER} != "no"
151	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
152	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
153	    ${DESTDIR}${INCLUDEDIR}/netinet
154.endif
155	cd ${.CURDIR}/../sys/contrib/pf/net; \
156	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
157	    ${DESTDIR}${INCLUDEDIR}/net
158	cd ${.CURDIR}/../sys/crypto; \
159	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
160	    ${DESTDIR}${INCLUDEDIR}/crypto
161	cd ${.CURDIR}/../sys/opencrypto; \
162	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
163	    ${DESTDIR}${INCLUDEDIR}/crypto
164	cd ${.CURDIR}/../sys/${MACHINE}/include; \
165	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
166	    ${DESTDIR}${INCLUDEDIR}/machine
167.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
168	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
169	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
170	    ${DESTDIR}${INCLUDEDIR}/machine/pc
171.endif
172.if defined(_MARCH)
173	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
174	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
175	cd ${.CURDIR}/../sys/${_MARCH}/include; \
176	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
177	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
178.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
179	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
180	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
181	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
182	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
183	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
184.endif
185.endif
186
187symlinks:
188	@${ECHO} "Setting up symlinks to kernel source tree..."
189.for i in ${LDIRS}
190	cd ${.CURDIR}/../sys/$i; \
191	for h in *.h; do \
192		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
193	done
194.endfor
195.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
196	cd ${.CURDIR}/../sys/$i; \
197	for h in *.h; do \
198		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
199	done
200.endfor
201	cd ${.CURDIR}/../sys/dev/acpica; \
202	for h in acpiio.h; do \
203		ln -fs ../../../../sys/dev/acpica/$$h \
204		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
205	done
206	cd ${.CURDIR}/../sys/dev/bktr; \
207	for h in ioctl_*.h; do \
208		ln -fs ../../../../sys/dev/bktr/$$h \
209		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
210	done
211.for i in ${LSUBSUBDIRS}
212	cd ${.CURDIR}/../sys/$i; \
213	for h in *.h; do \
214		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
215	done
216.endfor
217	cd ${.CURDIR}/../sys/contrib/altq/altq; \
218	for h in *.h; do \
219		ln -fs ../../../sys/contrib/altq/altq/$$h \
220		    ${DESTDIR}${INCLUDEDIR}/altq; \
221	done
222.if ${MK_IPFILTER} != "no"
223	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
224	for h in *.h; do \
225		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
226		    ${DESTDIR}${INCLUDEDIR}/netinet; \
227	done
228.endif
229	cd ${.CURDIR}/../sys/contrib/pf/net; \
230	for h in *.h; do \
231		ln -fs ../../../sys/contrib/pf/net/$$h \
232		    ${DESTDIR}${INCLUDEDIR}/net; \
233	done
234	cd ${.CURDIR}/../sys/crypto; \
235	for h in rijndael/rijndael.h; do \
236		ln -fs ../../../sys/crypto/$$h \
237		    ${DESTDIR}${INCLUDEDIR}/crypto; \
238	done
239	cd ${.CURDIR}/../sys/opencrypto; \
240	for h in *.h; do \
241		ln -fs ../../../sys/opencrypto/$$h \
242		    ${DESTDIR}${INCLUDEDIR}/crypto; \
243	done
244	cd ${.CURDIR}/../sys/${MACHINE}/include; \
245	for h in *.h; do \
246		ln -fs ../../../sys/${MACHINE}/include/$$h \
247		    ${DESTDIR}${INCLUDEDIR}/machine; \
248	done
249.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
250	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
251	for h in *.h; do \
252		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
253		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
254	done
255.endif
256.if defined(_MARCH)
257	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
258	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
259	cd ${.CURDIR}/../sys/${_MARCH}/include; \
260	for h in *.h; do \
261		ln -fs ../../../sys/${_MARCH}/include/$$h \
262		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
263	done
264.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
265	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
266	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
267	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
268	for h in *.h; do \
269		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
270		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
271	done
272.endif
273.endif
274