Standardize License information
[openafs.git] / src / config / Makefile
1 # Copyright 2000, International Business Machines Corporation and others.
2 # All Rights Reserved.
3
4 # This software has been released under the terms of the IBM Public
5 # License.  For details, see the LICENSE file in the top-level source
6 # directory or online at http://www.openafs.org/dl/license10.html
7
8 KERNELDIR=../libafs
9 UKERNELDIR=../libuafs
10 SHELL=/bin/sh
11 COMPONENT=config
12 include Makefile.${SYS_NAME}
13
14 MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
15
16 CFLAGS=-g -I${DESTDIR}include ${XCFLAGS}
17
18 noversion: install.noversion
19
20 KDIRS = ${KERNELDIR}/afs ${KERNELDIR}/rx ${KERNELDIR}/afsint \
21         ${DESTDIR}include/afs ${KERNELDIR}/config
22
23 UKDIRS = ${UKERNELDIR}/afs ${UKERNELDIR}/rx ${UKERNELDIR}/afsint \
24          ${UKERNELDIR}/config
25
26 noversionMakef: $(KDIRS)
27         -if [ ! -f Makefile.version ] ; \
28         then \
29                 $(CP) Makefile.version-NOCML Makefile.version; \
30                 $(MAKE) -f Makefile.version  AFS_component_version_number.c; \
31         fi; 
32
33 version: ${DESTDIR}bin/mkvers Makefile.version
34         $(MAKE) -f Makefile.version  AFS_component_version_number.c
35
36 ${DESTDIR}bin/mkvers: mkvers.c
37         set ${DESTDIR}bin; $(MKDIR_IF_NEEDED)
38         $(CC) -o ${DESTDIR}bin/mkvers mkvers.c
39
40 Makefile.version: Makefile.version-CML Makefile.version-NOCML
41         $(RM) -f Makefile.version
42         set -x ; \
43         if      [ -r SRC/../CML/state ] ; \
44         then    $(CP) Makefile.version-CML Makefile.version ; \
45         else    $(CP) Makefile.version-NOCML Makefile.version ; \
46         fi
47
48 all: config
49
50 mc.o: mc.c
51
52 config.o: config.c AFS_component_version_number.c
53
54 config: config.o mc.o
55         $(SPEW) $(CC) $(CFLAGS) -o config config.o mc.o
56
57 param.xxx:
58
59 $(KDIRS): 
60         set $@; $(MKDIR_IF_NEEDED)
61
62 ${KERNELDIR}/afs/AFS_component_version_number.c: AFS_component_version_number.c
63         -$(RM) -f $@; $(CP) $? $@
64
65 ${KERNELDIR}/afs/param.h ${DESTDIR}include/afs/param.h :: param.${SYS_NAME}.h
66         -$(RM) -f $@; $(CP) $? $@
67
68 ${KERNELDIR}/afs/afs_sysnames.h ${DESTDIR}include/afs/afs_sysnames.h :: afs_sysnames.h
69         $(RM) -f $@; $(CP) $? $@
70
71 DESTINCLS = ${DESTDIR}include/afs/afs_args.h ${DESTDIR}include/afs/venus.h ${DESTDIR}include/afs/debug.h ${DESTDIR}include/afs/afs_sysnames.h  ${DESTDIR}include/afs/param.h  ${DESTDIR}include/afs/stds.h  ${DESTDIR}include/afs/icl.h ../permit_xprt.h
72
73 ${KERNELDIR}/afs/stds.h ${DESTDIR}include/afs/stds.h :: stds.h
74         $(RM) -f $@; $(CP) $? $@
75
76 ${KERNELDIR}/config/Makefile.${SYS_NAME} :: Makefile.${SYS_NAME}
77         $(RM) -f $@; $(CP) $? $@
78
79 ${KERNELDIR}/afs/icl.h ${DESTDIR}include/afs/icl.h :: icl.h 
80         $(RM) -f $@; $(CP) $? $@
81
82 ${KERNELDIR}/afs/afs_args.h ${DESTDIR}include/afs/afs_args.h :: afs_args.h 
83         $(RM) -f $@; $(CP) $? $@
84
85 ${DESTDIR}include/afs/venus.h :: venus.h 
86         $(RM) -f $@; $(CP) $? $@
87
88 ${DESTDIR}include/afs/debug.h :: debug.h 
89         $(RM) -f $@; $(CP) $? $@
90
91 ${KERNELDIR}/afs/permit_xprt.h ../permit_xprt.h:
92         $(RM) -f ${KERNELDIR}/afs/permit_xprt.h ../permit_xprt.h
93         if [ -f SRC/../xprt/permit_xprt.h ] ; then \
94            echo "XPRT" ; \
95            perm_src=`pwd`/../xprt ; \
96            echo "perm_src='$$perm_src'" ; \
97            set -x ; \
98            ln -s $$perm_src/permit_export.h ${KERNELDIR}/afs/permit_xprt.h ; \
99            ln -s $$perm_src/permit_xprt.h   ../permit_xprt.h ; \
100         else \
101            echo "CONFIG" ; \
102            perm_src=`pwd` ; \
103            echo "perm_src='$$perm_src'" ; \
104            set -x ; \
105            ln -s $$perm_src/permit_xprt.h   ${KERNELDIR}/afs/permit_xprt.h ; \
106            ln -s $$perm_src/permit_xprt.h   ../permit_xprt.h ; \
107         fi                   
108
109 $(UKDIRS): 
110         set $@; $(MKDIR_IF_NEEDED)
111
112 ${UKERNELDIR}/afs/AFS_component_version_number.c: AFS_component_version_number.c
113         -$(RM) -f $@; $(CP) $? $@
114
115 ${UKERNELDIR}/afs/param.h :: param.${SYS_NAME}_usr.h
116         -$(RM) -f $@; $(CP) $? $@
117
118 ${UKERNELDIR}/afs/afs_sysnames.h :: afs_sysnames.h
119         $(RM) -f $@; $(CP) $? $@
120
121 ${UKERNELDIR}/afs/stds.h :: stds.h
122         $(RM) -f $@; $(CP) $? $@
123
124 ${UKERNELDIR}/config/Makefile.${SYS_NAME} :: Makefile.${SYS_NAME}
125         $(RM) -f $@; $(CP) $? $@
126
127 ${UKERNELDIR}/afs/icl.h :: icl.h 
128         $(RM) -f $@; $(CP) $? $@
129
130 ${UKERNELDIR}/afs/venus.h :: venus.h 
131         $(RM) -f $@; $(CP) $? $@
132
133 ${UKERNELDIR}/afs/afs_args.h :: afs_args.h 
134         $(RM) -f $@; $(CP) $? $@
135
136 ${UKERNELDIR}/afs/permit_xprt.h:
137         $(RM) -f ${UKERNELDIR}/afs/permit_xprt.h
138         if [ -f SRC/../xprt/permit_xprt.h ] ; then \
139            echo "XPRT" ; \
140            perm_src=`pwd`/../xprt ; \
141         else \
142            echo "CONFIG" ; \
143            perm_src=`pwd`/../config ; \
144         fi; \
145         echo "perm_src='$$perm_src'" ; \
146         set -x ; \
147         ln -s $$perm_src/permit_xprt.h   ${UKERNELDIR}/afs/permit_xprt.h
148
149 # lkversion is the target the Linux build uses to verify the build machine
150 # has headers in the right place for the requested kernel builds.
151 #
152 # To add AFS support to a new Linux kernel rev, see comments in the file
153 # ./linux-version.
154 #
155 lkversion:
156         case ${SYS_NAME} in \
157         *linux* ) \
158                 LINUX_SRCDIR="$(LINUX_SRCDIR)"; export LINUX_SRCDIR; \
159                 LINUX_VERS="$(LINUX_VERS)"; export LINUX_VERS; \
160                 sh ./linux-version ; \
161         esac
162
163 install.noversion: $(KDIRS) noversionMakef all $(DESTINCLS) venus.h
164         $(RM) -f ${DESTDIR}/include/afs/permit_xprt.h
165         $(CP) permit_xprt.h ${DESTDIR}/include/afs/
166
167 system: install
168 install: version install.noversion kinstall ukinstall
169
170 # these are needed to compile the kernel.  Config is necessary to
171 # convert the MakefileProto in libafs and the kernel links provide the
172 # kernel include environment.  param.h is, well, param.h.  The afs_sysnames.h
173 # file is needed by param.h to create unique identifiers for each SYS_TYPE.
174
175 kinstall: lkversion config $(KDIRS) ${KERNELDIR}/afs/param.h \
176         ${KERNELDIR}/afs/stds.h \
177         ${KERNELDIR}/afs/permit_xprt.h ${KERNELDIR}/afs/afs_sysnames.h \
178         ${KERNELDIR}/config/Makefile.${SYS_NAME} \
179         ${KERNELDIR}/afs/afs_args.h \
180         ${KERNELDIR}/afs/icl.h \
181         ${KERNELDIR}/afs/AFS_component_version_number.c
182
183 ukinstall webinstall: $(DESTINCLS) config $(UKDIRS) ${UKERNELDIR}/afs/param.h ${UKERNELDIR}/afs/stds.h \
184         ${UKERNELDIR}/afs/permit_xprt.h ${UKERNELDIR}/afs/afs_sysnames.h \
185         ${UKERNELDIR}/config/Makefile.${SYS_NAME} \
186         ${UKERNELDIR}/afs/afs_args.h \
187         ${UKERNELDIR}/afs/icl.h \
188         ${UKERNELDIR}/afs/venus.h \
189         ${UKERNELDIR}/afs/AFS_component_version_number.c
190
191 clean:
192         $(RM) -f *.o config core xprt