Makefile revision 143013
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 143013 2005-03-02 10:45:09Z njl $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
618420SbdeCLEANFILES= osreldate.h version vers.c
796462SruSUBDIR= arpa protocols rpcsvc rpc
8133567StjrINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
9133559Stjr	db.h \
10107046Smarcel	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
11131661Sdas	fts.h ftw.h getopt.h glob.h grp.h \
12131661Sdas	hesiod.h histedit.h ieeefp.h ifaddrs.h \
13107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
14107046Smarcel	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
15113595Snectar	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
16132173Sdavidxu	proc_service.h pthread.h \
17107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
18142582Sru	resolv.h runefile.h runetype.h search.h setjmp.h sgtty.h \
19142582Sru	signal.h stab.h \
20121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
21133333Sstefanf	strings.h sysexits.h tar.h tgmath.h \
22133333Sstefanf	time.h timeconv.h timers.h ttyent.h \
23119630Skan	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
24119630Skan	wctype.h wordexp.h
251539Srgrimes
26119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
2734030Sdufault
28104219Smike# posix4/mqueue.h is useless without an implementation and isn't installed:
29104634SmikePHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
3034030Sdufault
3188055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
3264767Sjhb	termios.h ucontext.h
331539Srgrimes
34116948SsamLDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
35116948Ssam	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
3683653Speter	pccard posix4 sys vm
3717900Speter
38140246SddsLSUBDIRS=	cam/scsi \
39142744Snjl	dev/acpica dev/an dev/bktr dev/firewire \
40142744Snjl	dev/ic dev/iicbus ${_dev_ieee488} dev/ofw \
41141397Sphk	dev/pbio dev/ppbus dev/smbus dev/usb dev/wi dev/utopia \
42140246Sdds	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
43140246Sdds	fs/nwfs fs/portalfs fs/procfs fs/smbfs fs/udf fs/umapfs \
44140246Sdds	fs/unionfs \
45133812Spjd	geom/concat geom/gate geom/label geom/mirror geom/nop geom/raid3 \
46140084Spjd	geom/shsec geom/stripe \
47140246Sdds	isofs/cd9660 \
48140246Sdds	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
49135339Sglebius	netgraph/atm netgraph/netflow \
50135339Sglebius	security/mac_biba security/mac_bsdextended security/mac_lomac \
51135339Sglebius	security/mac_mls security/mac_partition \
52137556Smarkm	ufs/ffs ufs/ufs
5377031Sru
54141397Sphk.if !defined(NO_GPIB)
55141397Sphk_dev_ieee488=	dev/ieee488
56141397Sphk.endif
57141397Sphk
58125123Semax.if !defined(NO_BLUETOOTH)
59114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
60125123Semax.endif
61107139Sjulian
6254351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
6354351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
6454351Smarcel# probably only useful for developers and should be avoided if you do not
6554351Smarcel# wish to tie your /usr/include and /usr/src together.
6654351Smarcel#SHARED=	symlinks
6754351SmarcelSHARED?=	copies
6854351Smarcel
6996462SruINCS+=	osreldate.h
7025734Speter
7136283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
7278376Speter		${.CURDIR}/../sys/sys/param.h \
7378376Speter		${.CURDIR}/Makefile
7425734Speter	@${ECHO} creating osreldate.h from newvers.sh
75117236Sru	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
76135371Sru	MAKE=${MAKE} . ${.CURDIR}/../sys/conf/newvers.sh;	\
7725734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
7872673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
79114731Sbde	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
8072673Speter	echo "#else" >> osreldate.h;				\
8125734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
8272673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
8372673Speter	echo "#endif" >> osreldate.h
8425734Speter
8588055Sru.for i in ${LHDRS}
8696462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
8717900Speter.endfor
8888055Sru.for i in ${MHDRS}
8996462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
9017900Speter.endfor
9188055Sru.for i in ${PHDRS}
9296462SruINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
9334030Sdufault.endfor
9454351Smarcel
95114731Sbde.include <bsd.prog.mk>
96114731Sbde
97114731Sbdeinstallincludes: ${SHARED}
98114731Sbde${SHARED}: compat
99114731Sbde
100114731Sbde# Take care of stale directory-level symlinks.
101114731Sbdecompat:
102114731Sbde.for i in ${LDIRS} ${LSUBDIRS} machine crypto
103114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
104114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
10554351Smarcel	fi
10654351Smarcel.endfor
107114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
108114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
109114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
110135851Sdougb.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
111135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
112135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
113135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
114135851Sdougb.endif
115114731Sbde
116114731Sbdecopies:
117137836Sru.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc
118114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
119114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
120114731Sbde	for h in *.h; do \
121114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
122114731Sbde	done
123114731Sbde.endif
124114731Sbde.endfor
125143013Snjl.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
12654351Smarcel	cd ${.CURDIR}/../sys; \
127114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
128114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
12954351Smarcel.endfor
130143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
131143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
132143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
133123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
134123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
135123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
136130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
137130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
138130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
139116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
140116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
141116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
142126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
143126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
144126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
145116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
146116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
147114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
14877857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
149114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
150114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
15193229Sru.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
15293229Sru	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
153114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
154114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
15577857Sjlemon.endif
1561539Srgrimes
15754351Smarcelsymlinks:
15854351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
15956645Speter.for i in ${LDIRS}
160114731Sbde	cd ${.CURDIR}/../sys/$i; \
161114731Sbde	for h in *.h; do \
162114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
163114731Sbde	done
16454351Smarcel.endfor
165143013Snjl.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
166114731Sbde	cd ${.CURDIR}/../sys/$i; \
167114731Sbde	for h in *.h; do \
168114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
169114731Sbde	done
17077046Sru.endfor
171143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
172143013Snjl	for h in acpiio.h; do \
173143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
174143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
175143013Snjl	done
176142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
177142992Sru	for h in ioctl_*.h; do \
178142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
179142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
180142992Sru	done
181114731Sbde.for i in ${LSUBSUBDIRS}
182114731Sbde	cd ${.CURDIR}/../sys/$i; \
183114731Sbde	for h in *.h; do \
184114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
185114731Sbde	done
186114731Sbde.endfor
187130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
188130416Smlaier	for h in *.h; do \
189130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
190130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
191130416Smlaier	done
192116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
193116734Sru	for h in *.h; do \
194116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
195116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
196116734Sru	done
197126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
198126385Smlaier	for h in *.h; do \
199126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
200126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
201126385Smlaier	done
202114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
203114731Sbde	for h in *.h; do \
204114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
205114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
206114731Sbde	done
207114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
208114731Sbde	for h in *.h; do \
209114731Sbde		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
210114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
211114731Sbde	done
212114731Sbde.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
213114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
214114731Sbde	for h in *.h; do \
215114731Sbde		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
216114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
217114731Sbde	done
218114731Sbde.endif
219