Initial import from FreeBSD RELENG_4:
[games.git] / include / Makefile
1 #       @(#)Makefile    8.2 (Berkeley) 1/4/94
2 # $FreeBSD: src/include/Makefile,v 1.109.2.27 2003/01/24 05:12:29 sam Exp $
3 #
4 # Doing a make install builds /usr/include
5 #
6 # The ``rm -rf''s used below are safe because rm doesn't follow symbolic
7 # links.
8
9 CLEANFILES= osreldate.h version vers.c
10 SUBDIR= arpa protocols rpc rpcsvc
11 INCS=   a.out.h ar.h assert.h bitstring.h complex.h ctype.h db.h \
12         dirent.h disktab.h \
13         dlfcn.h elf.h elf-hints.h err.h fnmatch.h fstab.h \
14         fts.h glob.h grp.h strhash.h histedit.h ieeefp.h ifaddrs.h iso646.h \
15         langinfo.h libgen.h limits.h link.h locale.h malloc.h memory.h mpool.h \
16         ndbm.h netdb.h nl_types.h nlist.h objformat.h \
17         paths.h pthread.h pthread_np.h pwd.h \
18         ranlib.h readpassphrase.h regex.h regexp.h resolv.h rune.h runetype.h \
19         search.h setjmp.h sgtty.h \
20         signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h \
21         string.h stringlist.h strings.h struct.h sysexits.h tar.h time.h \
22         timers.h ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
23
24 MHDRS=  float.h floatingpoint.h stdarg.h varargs.h
25
26 # posix4/aio.h conflicts with dysons and isn't installed:
27 PHDRS=  mqueue.h sched.h semaphore.h # aio.h
28
29 # Only for default SHARED=copies case
30 SHDRS=  soundcard.h joystick.h
31
32 LHDRS=  aio.h errno.h fcntl.h inttypes.h linker_set.h poll.h syslog.h \
33         termios.h ucontext.h
34
35 LDIRS=  cam msdosfs net netatalk netatm netgraph netinet netinet6 netipsec \
36         netipx netkey netnatm netncp netns netsmb nfs ntfs nwfs pccard posix4 \
37         sys vm
38
39 LSUBDIRS=       cam/scsi dev/an dev/firewire dev/ppbus dev/usb dev/wi \
40         fs/smbfs isofs/cd9660 \
41         netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
42         ufs/ffs ufs/mfs ufs/ufs
43
44 # For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
45 # are taken care of
46 LSYMSUBDIRS=    ${LSUBDIRS:Ncam/scsi:Nnetatm/*}
47
48 # Define SHARED to indicate whether you want symbolic links to the system
49 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
50 # probably only useful for developers and should be avoided if you do not
51 # wish to tie your /usr/include and /usr/src together.
52 #SHARED=        symlinks
53 SHARED?=        copies
54
55 INCS+=  osreldate.h
56
57 osreldate.h:    ${.CURDIR}/../sys/conf/newvers.sh \
58                 ${.CURDIR}/../sys/sys/param.h
59         @${ECHO} creating osreldate.h from newvers.sh
60         setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
61         . ${.CURDIR}/../sys/conf/newvers.sh;                    \
62         echo "$$COPYRIGHT" > osreldate.h;                       \
63         echo "#ifdef _KERNEL" >> osreldate.h;                   \
64         echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
65         echo "#else" >> osreldate.h;                            \
66         echo \#'undef __FreeBSD_version' >> osreldate.h;        \
67         echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
68         echo "#endif" >> osreldate.h
69
70 .for i in ${LHDRS}
71 INCSLINKS+=     sys/$i ${INCLUDEDIR}/$i
72 .endfor
73 .for i in ${MHDRS}
74 INCSLINKS+=     machine/$i ${INCLUDEDIR}/$i
75 .endfor
76 .for i in ${PHDRS}
77 INCSLINKS+=     posix4/$i ${INCLUDEDIR}/$i
78 .endfor
79
80 copies:
81 .for i in ${LDIRS} ${LSYMSUBDIRS} machine crypto
82         if [ -h ${DESTDIR}/usr/include/$i ]; then \
83                 rm -f ${DESTDIR}/usr/include/$i; \
84         fi
85 .endfor
86         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
87                 -p ${DESTDIR}/usr/include
88 .for i in ${LDIRS} ${LSUBDIRS}
89         cd ${.CURDIR}/../sys; \
90                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
91                 ${DESTDIR}/usr/include/$i
92 .endfor
93         cd ${.CURDIR}/../sys; \
94                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
95                 ${DESTDIR}/usr/include/crypto
96 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
97         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
98                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
99                 ${DESTDIR}/usr/include/machine
100 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
101         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
102                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
103                 ${DESTDIR}/usr/include/machine/pc
104 .endif
105 .endif
106 .for i in ${SHDRS}
107         ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
108 .endfor
109
110 symlinks:
111         @${ECHO} "Setting up symlinks to kernel source tree..."
112 .for i in ${LDIRS}
113         rm -rf ${DESTDIR}/usr/include/$i
114         ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
115 .endfor
116         rm -rf ${DESTDIR}/usr/include/crypto
117         ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
118 .for i in ${LSYMSUBDIRS}
119         rm -rf ${DESTDIR}/usr/include/$i
120         ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
121 .endfor
122         rm -rf ${DESTDIR}/usr/include/machine
123         ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
124
125 .include <bsd.prog.mk>
126
127 installincludes: ${SHARED}