xref: /freebsd/include/Makefile (revision 87569f75a91f298c52a71823c04d41cf53c88889)
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/audit \
53	security/mac_biba security/mac_bsdextended security/mac_lomac \
54	security/mac_mls security/mac_partition \
55	ufs/ffs ufs/ufs
56
57.if ${MK_GPIB} != "no"
58_dev_ieee488=	dev/ieee488
59.endif
60
61.if ${MK_HESIOD} != "no"
62INCS+=	hesiod.h
63.endif
64
65.if ${MK_BLUETOOTH} != "no"
66LSUBSUBDIRS=	netgraph/bluetooth/include
67.endif
68
69# Define SHARED to indicate whether you want symbolic links to the system
70# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
71# probably only useful for developers and should be avoided if you do not
72# wish to tie your /usr/include and /usr/src together.
73#SHARED=	symlinks
74SHARED?=	copies
75
76INCS+=	osreldate.h
77
78osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
79    ${.CURDIR}/Makefile
80	@${ECHO} creating osreldate.h from newvers.sh
81	@MAKE=${MAKE}; \
82	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
83	. ${.CURDIR}/../sys/conf/newvers.sh; \
84	echo "$$COPYRIGHT" > osreldate.h; \
85	echo "#ifdef _KERNEL" >> osreldate.h; \
86	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
87	echo "#else" >> osreldate.h; \
88	echo "#undef __FreeBSD_version" >> osreldate.h; \
89	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
90	echo "#endif" >> osreldate.h
91
92.for i in ${LHDRS}
93INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
94.endfor
95.for i in ${MHDRS}
96INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
97.endfor
98.for i in ${PHDRS}
99INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
100.endfor
101
102.if ${MACHINE} != ${MACHINE_ARCH}
103_MARCH=${MACHINE_ARCH}
104.endif
105
106.include <bsd.prog.mk>
107
108installincludes: ${SHARED}
109${SHARED}: compat
110
111# Take care of stale directory-level symlinks.
112compat:
113.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
114	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
115		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
116	fi
117.endfor
118	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
119	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
120	    -p ${DESTDIR}${INCLUDEDIR}
121.if ${MK_BIND_LIBS} != "no"
122	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
123	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
124	    -p ${DESTDIR}${INCLUDEDIR}
125.endif
126
127copies:
128.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
129	${_MARCH}
130.if exists(${DESTDIR}${INCLUDEDIR}/$i)
131	cd ${DESTDIR}${INCLUDEDIR}/$i; \
132	for h in *.h; do \
133		if [ -L $$h ]; then rm -f $$h; fi; \
134	done
135.endif
136.endfor
137.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
138	cd ${.CURDIR}/../sys; \
139	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
140	    ${DESTDIR}${INCLUDEDIR}/$i
141.endfor
142	cd ${.CURDIR}/../sys/dev/acpica; \
143	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
144	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
145	cd ${.CURDIR}/../sys/dev/bktr; \
146	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
147	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
148	cd ${.CURDIR}/../sys/contrib/altq/altq; \
149	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
150	    ${DESTDIR}${INCLUDEDIR}/altq
151.if ${MK_IPFILTER} != "no"
152	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
153	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
154	    ${DESTDIR}${INCLUDEDIR}/netinet
155.endif
156	cd ${.CURDIR}/../sys/contrib/pf/net; \
157	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
158	    ${DESTDIR}${INCLUDEDIR}/net
159	cd ${.CURDIR}/../sys/crypto; \
160	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
161	    ${DESTDIR}${INCLUDEDIR}/crypto
162	cd ${.CURDIR}/../sys/opencrypto; \
163	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
164	    ${DESTDIR}${INCLUDEDIR}/crypto
165	cd ${.CURDIR}/../sys/${MACHINE}/include; \
166	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
167	    ${DESTDIR}${INCLUDEDIR}/machine
168.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
169	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
170	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
171	    ${DESTDIR}${INCLUDEDIR}/machine/pc
172.endif
173.if defined(_MARCH)
174	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
175	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
176	cd ${.CURDIR}/../sys/${_MARCH}/include; \
177	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
178	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
179.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
180	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
181	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
182	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
183	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
184	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
185.endif
186.endif
187
188symlinks:
189	@${ECHO} "Setting up symlinks to kernel source tree..."
190.for i in ${LDIRS}
191	cd ${.CURDIR}/../sys/$i; \
192	for h in *.h; do \
193		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
194	done
195.endfor
196.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
197	cd ${.CURDIR}/../sys/$i; \
198	for h in *.h; do \
199		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
200	done
201.endfor
202	cd ${.CURDIR}/../sys/dev/acpica; \
203	for h in acpiio.h; do \
204		ln -fs ../../../../sys/dev/acpica/$$h \
205		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
206	done
207	cd ${.CURDIR}/../sys/dev/bktr; \
208	for h in ioctl_*.h; do \
209		ln -fs ../../../../sys/dev/bktr/$$h \
210		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
211	done
212.for i in ${LSUBSUBDIRS}
213	cd ${.CURDIR}/../sys/$i; \
214	for h in *.h; do \
215		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
216	done
217.endfor
218	cd ${.CURDIR}/../sys/contrib/altq/altq; \
219	for h in *.h; do \
220		ln -fs ../../../sys/contrib/altq/altq/$$h \
221		    ${DESTDIR}${INCLUDEDIR}/altq; \
222	done
223.if ${MK_IPFILTER} != "no"
224	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
225	for h in *.h; do \
226		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
227		    ${DESTDIR}${INCLUDEDIR}/netinet; \
228	done
229.endif
230	cd ${.CURDIR}/../sys/contrib/pf/net; \
231	for h in *.h; do \
232		ln -fs ../../../sys/contrib/pf/net/$$h \
233		    ${DESTDIR}${INCLUDEDIR}/net; \
234	done
235	cd ${.CURDIR}/../sys/crypto; \
236	for h in rijndael/rijndael.h; do \
237		ln -fs ../../../sys/crypto/$$h \
238		    ${DESTDIR}${INCLUDEDIR}/crypto; \
239	done
240	cd ${.CURDIR}/../sys/opencrypto; \
241	for h in *.h; do \
242		ln -fs ../../../sys/opencrypto/$$h \
243		    ${DESTDIR}${INCLUDEDIR}/crypto; \
244	done
245	cd ${.CURDIR}/../sys/${MACHINE}/include; \
246	for h in *.h; do \
247		ln -fs ../../../sys/${MACHINE}/include/$$h \
248		    ${DESTDIR}${INCLUDEDIR}/machine; \
249	done
250.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
251	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
252	for h in *.h; do \
253		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
254		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
255	done
256.endif
257.if defined(_MARCH)
258	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
259	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
260	cd ${.CURDIR}/../sys/${_MARCH}/include; \
261	for h in *.h; do \
262		ln -fs ../../../sys/${_MARCH}/include/$$h \
263		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
264	done
265.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
266	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
267	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
268	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
269	for h in *.h; do \
270		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
271		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
272	done
273.endif
274.endif
275