1 # Copyright 2000, International Business Machines Corporation and others.
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
9 include @TOP_OBJDIR@/src/config/Makefile.config
11 # tell bsd.kmod.mk to build us vnode_if*
14 # We must set SRCS to include at least one .c file if we are also using
15 # vnode_if.h, due to a bug in the system makefiles where the empty string
16 # gets expanded to a ".o" entry in OBJS, which there is (correctly) no
17 # rule to make. For simplicity, just set this as all of what would
18 # otherwise be AFS_OS_OBJS so that people have a familiar list to look for.
20 # OS specific "object" files:
43 # System specific build commands and flags
44 KSRC = @BSD_KERNEL_PATH@
45 KBLD = @BSD_KERNEL_BUILD@
47 LIBAFS_REQ_DIRS = $(DESTDIR)$(KMODDIR)/
49 # keep symbols if --enable-debug-kernel
50 AC_DEBUG_FLAGS = @DEBUG_FLAGS@
51 .if !empty(AC_DEBUG_FLAGS)
52 DEBUG_FLAGS= ${AC_DEBUG_FLAGS}
54 # For debug builds, we also need /usr/lib/debug/* dirs to exist
55 LIBAFS_REQ_DIRS += ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/
58 # We are not doing very well (WARNS=2 brings in printf format type checking)
60 # We have some sketchy code that redeclares prototypes
61 CWARNFLAGS+= -Wno-redundant-decls
63 GEN_KBLD_DIR=@abs_builddir@/kconf-GENERIC
64 AFS_OS_CLEAN=$(GEN_KBLD_DIR)
66 # Starting with FreeBSD 12, opt_global.h is effectively required to build, even
67 # for the GENERIC kernel. Normally this would be provided in the kernel build
68 # dir (--with-bsd-kernel-build). If that dir was not specified, we can still
69 # get the needed header files if we assume that the user is building for the
70 # GENERIC kernel. So if we don't have a kernel build dir, generate the header
71 # files in GEN_KBLD_DIR by using config(8), and specify that as the
72 # KERNBUILDDIR. This won't always work, of course, but it has a chance at
73 # working for the most common setups (when the user isn't using some custom
74 # kernel). The kernel headers, of course, we assume are in $(KSRC).
76 -mkdir $(GEN_KBLD_DIR)
77 cd $(KSRC)/$(MACHINE)/conf && \
78 /usr/sbin/config -d $(GEN_KBLD_DIR) GENERIC
80 # setup for bsd.kmod.mk infrastructure
81 .PATH: ${TOP_SRCDIR}/afs/FBSD
83 KERN_DEBUGDIR=/usr/lib/debug
88 KERNBUILDDIR=$(GEN_KBLD_DIR)
93 # Name of directory to hold object files and libraries.
96 # This tells Makefile.common to use it's single directory build target.
97 COMPDIRS = single_compdir
98 INSTDIRS = single_instdir
99 DESTDIRS = single_destdir
101 # The common sysincludes code needs the 'h' symlink.
102 # We cannot include bsd.kmod.mk in this file directly, because it will start
103 # generating headers and objects in this directory, which we want in $(KOBJ).
104 # We also need the install target from bsd.kmod.mk in $(KOBJ), but the one
105 # from Makefile.common in this directory. A prime candidate for cleanup.
106 setup: $(KERNBUILDDIR)
108 -$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common
109 $(CP) Makefile $(KOBJ)/Makefile
110 echo ".include <bsd.kmod.mk>" >> $(KOBJ)/Makefile
111 sed -e 's/^install:/afsinstall:/' Makefile.common > $(KOBJ)/Makefile.common
113 -ln -fs ${KSRC}/sys h
115 # Makefile.common sets AFSAOBJS, COMMON_INCLUDE, TOP_{SRC,OBJ}*, and the like.
116 # We must live with its other pollution of targets and build rules.
117 include Makefile.common
119 # we only do the no-NFS case
120 OBJS= ${AFSAOBJS} ${AFSNONFSOBJS}
124 LIBAFSNONFS= libafs.ko
125 DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
126 CFLAGS+= $(DEFINES) ${COMMON_INCLUDE}
128 INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
129 INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
131 DEST_LIBAFS = ${DEST}/root.client/bin/${LIBAFS}
132 DEST_LIBAFSNONFS = ${DEST}/root.client/bin/${LIBAFSNONFS}
134 $(DESTDIR)$(KMODDIR)/:
137 ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/:
140 install_libafs: $(LIBAFSNONFS) $(LIBAFS_REQ_DIRS) install
142 dest_libafs: $(LIBAFSNONFS)
143 ${INSTALL} -d ${DEST}/root.client/bin
144 ${INSTALL} -m 644 $(LIBAFSNONFS) $(DEST_LIBAFSNONFS)
146 # This is ugly, but the common infrastructure needs a libafs target.
147 libafs: depend $(LIBAFSNONFS)