xref: /freebsd/include/Makefile (revision 18d948adb10f2e46e8f7d9a5402dad1796b4d37e)
1996997fdSBruce Evans#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2a4add9a9SPeter Wemm# $FreeBSD$
359deaec5SRodney W. Grimes#
4a270eca5SBruce Evans# Doing a "make install" builds /usr/include.
559deaec5SRodney W. Grimes
6976cca35SBruce EvansCLEANFILES= osreldate.h version vers.c
7c7b111cbSRuslan ErmilovSUBDIR= arpa protocols rpcsvc rpc
829284d71SMike BarcroftINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
9c544e42bSMarcel Moolenaar	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
10c544e42bSMarcel Moolenaar	fts.h getopt.h glob.h grp.h hesiod.h histedit.h ieeefp.h ifaddrs.h \
11c544e42bSMarcel Moolenaar	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
12c544e42bSMarcel Moolenaar	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
1346d93063SJacques Vidrine	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
1446d93063SJacques Vidrine	pthread.h \
15c544e42bSMarcel Moolenaar	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
16c544e42bSMarcel Moolenaar	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
1779211790SPeter Wemm	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
18c544e42bSMarcel Moolenaar	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
19fefa0fd5SAlexander Kabaev	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
20fefa0fd5SAlexander Kabaev	wctype.h wordexp.h
2159deaec5SRodney W. Grimes
22fefa0fd5SAlexander KabaevMHDRS=	float.h floatingpoint.h stdarg.h
23917e476dSPeter Dufault
24793afc3aSMike Barcroft# posix4/mqueue.h is useless without an implementation and isn't installed:
255b0f380cSMike BarcroftPHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
26917e476dSPeter Dufault
27a7aaf57eSRuslan ErmilovLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
280e8911b3SJohn Baldwin	termios.h ucontext.h
2959deaec5SRodney W. Grimes
30d1ab0560SSam LefflerLDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
31d1ab0560SSam Leffler	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
3291196234SPeter Wemm	pccard posix4 sys vm
3315f3c66cSMarcel Moolenaar
34a5b5101fSDavid E. O'BrienLSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
35a5b5101fSDavid E. O'Brien	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
368a8402d3SRuslan Ermilov	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
3790768c55SScott Long	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs isofs/cd9660 \
389f1207d5SRuslan Ermilov	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
391a589a2bSHartmut Brandt	netgraph/atm security/mac_biba security/mac_bsdextended \
401a589a2bSHartmut Brandt	security/mac_lomac security/mac_mls security/mac_partition \
411a589a2bSHartmut Brandt	ufs/ffs ufs/ufs
4215f3c66cSMarcel Moolenaar
4318d948adSMaksim Yevmenkin.if !defined(NO_BLUETOOTH)
44a270eca5SBruce EvansLSUBSUBDIRS=	netgraph/bluetooth/include
4518d948adSMaksim Yevmenkin.endif
46c2608318SRuslan Ermilov
4715f3c66cSMarcel Moolenaar# Define SHARED to indicate whether you want symbolic links to the system
4815f3c66cSMarcel Moolenaar# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
4915f3c66cSMarcel Moolenaar# probably only useful for developers and should be avoided if you do not
5015f3c66cSMarcel Moolenaar# wish to tie your /usr/include and /usr/src together.
5115f3c66cSMarcel Moolenaar#SHARED=	symlinks
5215f3c66cSMarcel MoolenaarSHARED?=	copies
5359deaec5SRodney W. Grimes
54c7b111cbSRuslan ErmilovINCS+=	osreldate.h
553672faeaSPeter Wemm
563933c622SEivind Eklundosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
57766ea92bSPeter Wemm		${.CURDIR}/../sys/sys/param.h \
58766ea92bSPeter Wemm		${.CURDIR}/Makefile
593672faeaSPeter Wemm	@${ECHO} creating osreldate.h from newvers.sh
6025634026SRuslan Ermilov	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
613672faeaSPeter Wemm	. ${.CURDIR}/../sys/conf/newvers.sh;			\
623672faeaSPeter Wemm	echo "$$COPYRIGHT" > osreldate.h;			\
6344cde775SPeter Wemm	echo "#ifdef _KERNEL" >> osreldate.h;			\
64a270eca5SBruce Evans	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
6544cde775SPeter Wemm	echo "#else" >> osreldate.h;				\
663672faeaSPeter Wemm	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
6744cde775SPeter Wemm	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
6844cde775SPeter Wemm	echo "#endif" >> osreldate.h
693672faeaSPeter Wemm
70a7aaf57eSRuslan Ermilov.for i in ${LHDRS}
71c7b111cbSRuslan ErmilovINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
7202cca882SMarcel Moolenaar.endfor
73a7aaf57eSRuslan Ermilov.for i in ${MHDRS}
74c7b111cbSRuslan ErmilovINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
7502cca882SMarcel Moolenaar.endfor
76a7aaf57eSRuslan Ermilov.for i in ${PHDRS}
77c7b111cbSRuslan ErmilovINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
7802cca882SMarcel Moolenaar.endfor
7915f3c66cSMarcel Moolenaar
80a270eca5SBruce Evans.include <bsd.prog.mk>
81a270eca5SBruce Evans
82a270eca5SBruce Evansinstallincludes: ${SHARED}
83a270eca5SBruce Evans${SHARED}: compat
84a270eca5SBruce Evans
85a270eca5SBruce Evans# Take care of stale directory-level symlinks.
86a270eca5SBruce Evanscompat:
87a270eca5SBruce Evans.for i in ${LDIRS} ${LSUBDIRS} machine crypto
88a270eca5SBruce Evans	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
89a270eca5SBruce Evans		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
9015f3c66cSMarcel Moolenaar	fi
9115f3c66cSMarcel Moolenaar.endfor
92a270eca5SBruce Evans	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
93a270eca5SBruce Evans	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
94a270eca5SBruce Evans	    -p ${DESTDIR}${INCLUDEDIR}
95a270eca5SBruce Evans
96a270eca5SBruce Evanscopies:
97a270eca5SBruce Evans.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
98a270eca5SBruce Evans.if exists(${DESTDIR}${INCLUDEDIR}/$i)
99a270eca5SBruce Evans	cd ${DESTDIR}${INCLUDEDIR}/$i; \
100a270eca5SBruce Evans	for h in *.h; do \
101a270eca5SBruce Evans		if [ -L $$h ]; then rm -f $$h; fi; \
102a270eca5SBruce Evans	done
103a270eca5SBruce Evans.endif
104a270eca5SBruce Evans.endfor
105a5b5101fSDavid E. O'Brien.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
10615f3c66cSMarcel Moolenaar	cd ${.CURDIR}/../sys; \
10715f3c66cSMarcel Moolenaar	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
108a270eca5SBruce Evans	    ${DESTDIR}${INCLUDEDIR}/$i
10915f3c66cSMarcel Moolenaar.endfor
110a5b5101fSDavid E. O'Brien	cd ${.CURDIR}/../sys/dev/bktr; \
111a5b5101fSDavid E. O'Brien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
112a5b5101fSDavid E. O'Brien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
113a97ec006SRuslan Ermilov	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
114a97ec006SRuslan Ermilov	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
115a97ec006SRuslan Ermilov	    ${DESTDIR}${INCLUDEDIR}/netinet
116a97ec006SRuslan Ermilov	cd ${.CURDIR}/../sys/opencrypto; \
117a97ec006SRuslan Ermilov	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
118a270eca5SBruce Evans	    ${DESTDIR}${INCLUDEDIR}/crypto
11986663b44SJonathan Lemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
12086663b44SJonathan Lemon	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
121a270eca5SBruce Evans	    ${DESTDIR}${INCLUDEDIR}/machine
1229f1207d5SRuslan Ermilov.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
1239f1207d5SRuslan Ermilov	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
1249f1207d5SRuslan Ermilov	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
125a270eca5SBruce Evans	    ${DESTDIR}${INCLUDEDIR}/machine/pc
1269f1207d5SRuslan Ermilov.endif
12759deaec5SRodney W. Grimes
12815f3c66cSMarcel Moolenaarsymlinks:
12915f3c66cSMarcel Moolenaar	@${ECHO} "Setting up symlinks to kernel source tree..."
130400dc950SPeter Wemm.for i in ${LDIRS}
131a270eca5SBruce Evans	cd ${.CURDIR}/../sys/$i; \
132a270eca5SBruce Evans	for h in *.h; do \
133a270eca5SBruce Evans		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
134a270eca5SBruce Evans	done
13515f3c66cSMarcel Moolenaar.endfor
136a270eca5SBruce Evans.for i in ${LSUBDIRS}
137a270eca5SBruce Evans	cd ${.CURDIR}/../sys/$i; \
138a270eca5SBruce Evans	for h in *.h; do \
139a270eca5SBruce Evans		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
140a270eca5SBruce Evans	done
141400dc950SPeter Wemm.endfor
142a270eca5SBruce Evans.for i in ${LSUBSUBDIRS}
143a270eca5SBruce Evans	cd ${.CURDIR}/../sys/$i; \
144a270eca5SBruce Evans	for h in *.h; do \
145a270eca5SBruce Evans		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
146a270eca5SBruce Evans	done
147a270eca5SBruce Evans.endfor
148a97ec006SRuslan Ermilov	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
149a97ec006SRuslan Ermilov	for h in *.h; do \
150a97ec006SRuslan Ermilov		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
151a97ec006SRuslan Ermilov		    ${DESTDIR}${INCLUDEDIR}/netinet; \
152a97ec006SRuslan Ermilov	done
153a270eca5SBruce Evans	cd ${.CURDIR}/../sys/opencrypto; \
154a270eca5SBruce Evans	for h in *.h; do \
155a270eca5SBruce Evans		ln -fs ../../../sys/opencrypto/$$h \
156a270eca5SBruce Evans		    ${DESTDIR}${INCLUDEDIR}/crypto; \
157a270eca5SBruce Evans	done
158a270eca5SBruce Evans	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
159a270eca5SBruce Evans	for h in *.h; do \
160a270eca5SBruce Evans		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
161a270eca5SBruce Evans		    ${DESTDIR}${INCLUDEDIR}/machine; \
162a270eca5SBruce Evans	done
163a270eca5SBruce Evans.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
164a270eca5SBruce Evans	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
165a270eca5SBruce Evans	for h in *.h; do \
166a270eca5SBruce Evans		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
167a270eca5SBruce Evans		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
168a270eca5SBruce Evans	done
169a270eca5SBruce Evans.endif
170