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