Add getopt_long from NetBSD
[dragonfly.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 # $DragonFly: src/include/Makefile,v 1.14 2004/01/31 13:38:48 joerg Exp $
4 #
5 # Doing a make install builds /usr/include
6 #
7 # The ``rm -rf''s used below are safe because rm doesn't follow symbolic
8 # links.
9
10 CLEANFILES= osreldate.h version vers.c
11 SUBDIR= arpa protocols rpc rpcsvc
12 INCS=   a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
13         dirent.h disktab.h \
14         dlfcn.h elf.h elf-hints.h err.h fnmatch.h fstab.h \
15         fts.h getopt.h glob.h grp.h strhash.h histedit.h ieeefp.h ifaddrs.h \
16         iso646.h inttypes.h \
17         langinfo.h libgen.h limits.h link.h locale.h malloc.h memory.h \
18         mpool.h ndbm.h netdb.h nl_types.h nlist.h objformat.h \
19         paths.h pthread.h pthread_np.h pwd.h \
20         ranlib.h readpassphrase.h regex.h regexp.h resolv.h re_comp.h rmd160.h \
21         rune.h runetype.h search.h setjmp.h sgtty.h \
22         signal.h stab.h stdarg.h stdbool.h stddef.h stdint.h stdio.h stdlib.h \
23         string.h stringlist.h strings.h struct.h sysexits.h tar.h time.h \
24         timers.h ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
25
26 MHDRS=  float.h floatingpoint.h varargs.h
27
28 # posix4/aio.h conflicts with dysons and isn't installed:
29 PHDRS=  mqueue.h sched.h semaphore.h # aio.h
30
31 # Only for default SHARED=copies case
32 SHDRS=  soundcard.h joystick.h
33
34 LHDRS=  aio.h errno.h fcntl.h linker_set.h poll.h syslog.h \
35         termios.h ucontext.h
36
37 # directories which also contain header files that need to be coiped.
38 # Other directories, like 'bus' and 'netproto', are created using mtree.
39 #
40 # XXX allow these directories to not contain header files.
41 LDIRS=  net netgraph netinet netinet6 sys vm
42
43 # Subdirectories containing header files to copy.  In symlink mode 
44 # the subdirectory will be symlinked.  Care must be taken to adjust
45 # LSYMSUBDIRS below to remove subdirectories whos parent directories.
46 # If you make a mistake, part of your source tree might get overwritten
47 # when buildworld is run.
48 #
49 LSUBDIRS=       bus/cam bus/cam/scsi \
50         emulation/posix4 \
51         emulation/linux \
52         vfs/msdosfs vfs/nfs vfs/ntfs vfs/nwfs \
53         vfs/ufs vfs/smbfs \
54         net/vlan net/ipfw net/ip6fw net/dummynet net/sppp net/ip_mroute \
55         net/bridge net/tun net/ppp net/ppp_layer net/sl \
56         netgraph/UI netgraph/async netgraph/bpf netgraph/bridge \
57         netgraph/cisco netgraph/echo netgraph/eiface netgraph/etf \
58         netgraph/ether netgraph/fec netgraph/frame_relay netgraph/hole \
59         netgraph/iface netgraph/ksocket netgraph/l2tp netgraph/lmi \
60         netgraph/mppc netgraph/one2many netgraph/ppp \
61         netgraph/pppoe netgraph/pptpgre netgraph/rfc1490 netgraph/socket \
62         netgraph/tee netgraph/tty netgraph/vjc \
63         bus/cam bus/usb bus/pccard bus/pci bus/isa \
64         netproto/atalk netproto/atm netproto/ipsec netproto/ipx \
65         netproto/key netproto/natm netproto/ncp netproto/ns netproto/smb \
66         netproto/atm/ipatm netproto/atm/sigpvc netproto/atm/spans \
67         netproto/atm/uni
68
69 LSUBDIRS3= vfs/isofs/cd9660 net/i4b/include \
70         dev/misc/lpt dev/netif/wi
71
72 # For SHARED=symlinks, bus/cam and netproto/atm are symlinks, so cam/scsi
73 # and netproto/atm/* are taken care of
74 LSYMSUBDIRS=    ${LSUBDIRS:Nbus/cam/scsi:Nnetproto/atm/*:Nnet/*:Nnetgraph/*}
75 LSYMSUBDIRS3=   ${LSUBDIRS3:Nnet/*}
76
77 # For obsolete headers which need to be removed
78 RMHEADERS=      machine/ansi.h sys/inttypes.h
79
80 # Define SHARED to indicate whether you want symbolic links to the system
81 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
82 # probably only useful for developers and should be avoided if you do not
83 # wish to tie your /usr/include and /usr/src together.
84 #SHARED=        symlinks
85 SHARED?=        copies
86
87 INCS+=  osreldate.h
88
89 osreldate.h:    ${.CURDIR}/../sys/conf/newvers.sh \
90                 ${.CURDIR}/../sys/sys/param.h
91         @${ECHO} creating osreldate.h from newvers.sh
92         setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
93         . ${.CURDIR}/../sys/conf/newvers.sh;                    \
94         echo "$$COPYRIGHT" > osreldate.h;                       \
95         echo "#ifdef _KERNEL" >> osreldate.h;                   \
96         echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
97         echo "#else" >> osreldate.h;                            \
98         echo \#'undef __DragonFly_version' >> osreldate.h;      \
99         echo \#'define __DragonFly_version' $$RELDATE >> osreldate.h; \
100         echo \#'undef __FreeBSD_version' >> osreldate.h;        \
101         echo \#'define __FreeBSD_version' 480101  >> osreldate.h; \
102         echo "#endif" >> osreldate.h
103
104 .for i in ${LHDRS}
105 INCSLINKS+=     sys/$i ${INCLUDEDIR}/$i
106 .endfor
107 .for i in ${MHDRS}
108 INCSLINKS+=     machine/$i ${INCLUDEDIR}/$i
109 .endfor
110 .for i in ${PHDRS}
111 INCSLINKS+=     emulation/posix4/$i ${INCLUDEDIR}/$i
112 .endfor
113 INCSLINKS+=     bus/cam ${INCLUDEDIR}/cam
114 INCSLINKS+=     vfs/msdosfs ${INCLUDEDIR}/msdosfs
115 INCSLINKS+=     vfs/isofs ${INCLUDEDIR}/isofs
116 INCSLINKS+=     vfs/mfs ${INCLUDEDIR}/mfs
117 INCSLINKS+=     vfs/nfs ${INCLUDEDIR}/nfs
118 INCSLINKS+=     vfs/ntfs ${INCLUDEDIR}/ntfs
119 INCSLINKS+=     vfs/nwfs ${INCLUDEDIR}/nwfs
120 INCSLINKS+=     vfs ${INCLUDEDIR}/fs
121 # this is for <ufs/ufs/...> and <ufs/ffs/...> paths used by ports
122 # It is hopefully a temporary hack until we have environments working.
123 INCSLINKS+=     vfs ${INCLUDEDIR}/ufs
124 INCSLINKS+=     ufs ${INCLUDEDIR}/vfs/ffs
125 INCSLINKS+=     emulation ${INCLUDEDIR}/compat
126 INCSLINKS+=     netproto/atalk ${INCLUDEDIR}/netatalk
127 INCSLINKS+=     netproto/atm ${INCLUDEDIR}/netatm
128 INCSLINKS+=     netproto/ipsec ${INCLUDEDIR}/netipsec
129 INCSLINKS+=     netproto/ipx ${INCLUDEDIR}/netipx
130 INCSLINKS+=     netproto/key ${INCLUDEDIR}/netkey
131 INCSLINKS+=     netproto/natm ${INCLUDEDIR}/netnatm
132 INCSLINKS+=     netproto/ncp ${INCLUDEDIR}/netncp
133 INCSLINKS+=     netproto/ns ${INCLUDEDIR}/netns
134 INCSLINKS+=     netproto/smb ${INCLUDEDIR}/netsmb
135 INCSLINKS+=     bus/pccard ${INCLUDEDIR}/pccard
136
137 mtree_setup:
138 .for i in ${LDIRS} ${LSYMSUBDIRS} ${LSYMSUBDIRS3} machine crypto
139         if [ -h ${DESTDIR}/usr/include/$i ]; then \
140                 rm -f ${DESTDIR}/usr/include/$i; \
141         fi
142 .endfor
143         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
144                 -p ${DESTDIR}/usr/include
145
146 copies:         mtree_setup
147 .for i in ${LDIRS} ${LSUBDIRS} ${LSUBDIRS3}
148         cd ${.CURDIR}/../sys; \
149                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
150                 ${DESTDIR}/usr/include/$i
151 .endfor
152         cd ${.CURDIR}/../sys; \
153                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
154                 ${DESTDIR}/usr/include/crypto
155 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
156         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
157                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
158                 ${DESTDIR}/usr/include/machine
159 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
160         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
161                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
162                 ${DESTDIR}/usr/include/machine/pc
163 .endif
164 .endif
165 .if exists(${.CURDIR}/../sys/net/i4b/include/${MACHINE_ARCH})
166         cd ${.CURDIR}/../sys/net/i4b/include/${MACHINE_ARCH}; \
167                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
168                 ${DESTDIR}/usr/include/i4b_machine
169 .endif
170 .for i in ${SHDRS}
171         ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
172 .endfor
173 .for i in ${RMHEADERS}
174         rm -f ${DESTDIR}/usr/include/$i
175 .endfor
176
177 symlinks:       mtree_setup
178         @${ECHO} "Setting up symlinks to kernel source tree..."
179 .for i in ${LDIRS}
180         rm -rf ${DESTDIR}/usr/include/$i
181         ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
182 .endfor
183         rm -rf ${DESTDIR}/usr/include/crypto
184         ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
185 .for i in ${LSYMSUBDIRS}
186         rm -rf ${DESTDIR}/usr/include/$i
187         ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
188 .endfor
189 .for i in ${LSYMSUBDIRS3}
190         rm -rf ${DESTDIR}/usr/include/$i
191         ln -s ../../../../sys/$i ${DESTDIR}/usr/include/$i
192 .endfor
193         rm -rf ${DESTDIR}/usr/include/machine
194         ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
195         rm -rf ${DESTDIR}/usr/include/i4b_machine
196         ln -s ../../sys/net/i4b/include/${MACHINE_ARCH} ${DESTDIR}/usr/include/i4b_machine
197
198 .include <bsd.prog.mk>
199
200 installincludes: ${SHARED}