Skip to content

Commit

Permalink
Use existing kmod build infrastructure to add in files from src/io/de…
Browse files Browse the repository at this point in the history
…scription.

Avoids trying to guess the kernel cflags by hand in the top-level Makefile,
and puts all kernel building under "make kmod".
  • Loading branch information
Pete Wyckoff committed Jan 28, 2008
1 parent 5dcf752 commit a57a123
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 35 deletions.
26 changes: 3 additions & 23 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,6 @@ endif
#
# run ./configure --help for information on how to do this cleanly.
LIBCFLAGS=@LIBCFLAGS@ -D__PVFS2_CLIENT__
KLIBCFLAGS=$(LIBCFLAGS) -D__KERNEL__ -I@LINUX_KERNEL_SRC@/include -Wall \
-I . -I $(srcdir) -I $(srcdir)/include -Wstrict-prototypes -Wcast-align -Wbad-function-cast -Wmissing-prototypes \
-Wmissing-declarations -Wundef -Wpointer-arith -Wnested-externs -fno-stack-protector
KLIBCFLAGS+=$(patsubst %,-I$(srcdir)/%,$(INCLUDES))
LIBTHREADEDCFLAGS=-D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ -D__PVFS2_CLIENT__
LIBS += @THREAD_LIB@
LIBS_THREADED += @THREAD_LIB@
Expand Down Expand Up @@ -404,9 +400,6 @@ ADMINSRC :=
ADMINSRC_SERVER :=
# LIBSRC is source code for libpvfs2
LIBSRC :=
# LIBKSRC is source code for a small portion of libpvfs2 that we use in the
# kernel
LIBKSRC :=
# SERVERSRC is souce code for the pvfs2 server
SERVERSRC :=
# DOCSRC is source code for documentation
Expand Down Expand Up @@ -442,7 +435,6 @@ endif
# LIBRARIES is a list of the pvfs2 client libraries
LIBRARIES :=
LIBRARIES_THREADED :=
KLIBRARIES :=
ifeq ($(build_shared),yes)
LIBRARIES_SHARED = lib/libpvfs2.so
LIBRARIES += $(LIBRARIES_SHARED)
Expand All @@ -453,7 +445,6 @@ LIBRARIES += $(LIBRARIES_STATIC)
LIBRARIES_THREADED_STATIC = lib/libpvfs2-threaded.a
LIBRARIES_THREADED += $(LIBRARIES_THREADED_STATIC)
endif
KLIBRARIES += lib/libkpvfs2.a

################################################################
# Default target forward pointer, to avoid other targets in make stubs
Expand All @@ -477,8 +468,6 @@ include $(patsubst %, %/module.mk, $(MODULES))

# LIBOBJS is a list of objects to put in the client lib
LIBOBJS := $(patsubst %.c,%.o, $(filter %.c,$(LIBSRC)))
# LIBKOBJS is a subset of objects to put in the client lib in kernel
LIBKOBJS := $(patsubst %.c,%-kernel.o, $(filter %.c,$(LIBKSRC)))
# LIBPICOBJS are the same, but compiled for use in a shared library
LIBPICOBJS := $(patsubst %.c,%.po, $(filter %.c,$(LIBSRC)))
# LIBDEPENDS is a list of dependency files for the client lib
Expand Down Expand Up @@ -565,7 +554,7 @@ DEPENDS := $(sort $(LIBDEPENDS) $(SERVERDEPENDS) $(MISCDEPENDS) \
# Rules and dependencies

# default rule builds server, library, and applications
all:: $(SERVER) $(KARMA) $(LIBRARIES) $(KLIBRARIES) admintools $(VISS) $(KARMA)
all:: $(SERVER) $(KARMA) $(LIBRARIES) admintools $(VISS) $(KARMA)

# target for building admin tools
admintools: $(ADMINTOOLS) $(ADMINTOOLS_SERVER)
Expand Down Expand Up @@ -642,11 +631,6 @@ lib/libpvfs2.a: $(LIBOBJS)
$(E)$(INSTALL) -d lib
$(E)ar rcs $@ $(LIBOBJS)

lib/libkpvfs2.a: $(LIBKOBJS)
$(Q) " LD -r $@"
$(E)$(INSTALL) -d lib
$(E)ld -r -o $@ $(LIBKOBJS)

# rule for building the _multithreaded_ pvfs2 library
lib/libpvfs2-threaded.a: $(LIBTHREADEDOBJS)
$(Q) " RANLIBTHREADED $@"
Expand Down Expand Up @@ -681,10 +665,6 @@ $(VISS): %: %.o $(VISMISCOBJS) $(LIBRARIES)
$(Q) " LD $@"
$(E)$(LD) -o $@ $(LDFLAGS) $< $(VISMISCOBJS) $(LIBS) $(call modldflags,$<)

$(LIBKOBJS): %-kernel.o: %.c
$(Q) " CC $@"
$(E)$(CC) $(KLIBCFLAGS) $(call modcflags,$<) $< -c -o $@

# default rule for building executables from object files
%: %.o $(LIBRARIES)
$(Q) " LD $@"
Expand Down Expand Up @@ -797,8 +777,8 @@ docsclean:
# top rule for cleaning up tree
clean::
$(Q) " CLEAN"
$(E)rm -f $(LIBOBJS) $(LIBKOBJS) $(LIBTHREADEDOBJS) $(SERVEROBJS) $(MISCOBJS) \
$(LIBRARIES) $(KLIBRARIES) $(LIBRARIES_THREADED) $(DEPENDS) $(SERVER) \
$(E)rm -f $(LIBOBJS) $(LIBTHREADEDOBJS) $(SERVEROBJS) $(MISCOBJS) \
$(LIBRARIES) $(LIBRARIES_THREADED) $(DEPENDS) $(SERVER) \
$(ADMINOBJS) $(ADMINOBJS_SERVER) $(ADMINTOOLS)\
$(ADMINTOOLS_SERVER) lib/libpvfs2-server.a\
$(KERNAPPOBJS) $(KERNAPPS) $(KERNAPPSTHR) \
Expand Down
8 changes: 0 additions & 8 deletions src/io/description/module.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ LIBSRC += \
$(DIR)/dist-twod-stripe.c \
$(DIR)/dist-varstrip.c

LIBKSRC += \
$(DIR)/pvfs-request.c \
$(DIR)/pint-request.c \
$(DIR)/pint-distribution.c \
$(DIR)/pint-dist-utils.c \
$(DIR)/dist-basic.c \
$(DIR)/dist-simple-stripe.c

SERVERSRC += \
$(DIR)/pvfs-request.c \
$(DIR)/pint-request.c \
Expand Down
23 changes: 19 additions & 4 deletions src/kernel/linux-2.6/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ hsrc = \
pvfs2-proc.h \
osd.h

objs = $(csrc:.c=.o)
desc_here := src/io/description
desc_csrc := \
pvfs-request.c \
pint-request.c \
pint-distribution.c \
pint-dist-utils.c \
dist-basic.c \
dist-simple-stripe.c

objs = $(csrc:.c=.o) $(desc_csrc:.c=.o)
othergen = pvfs2.o pvfs2.ko pvfs2.mod.c pvfs2.mod.o
othergendir = .tmp_versions # around 2.6.6 this is generated locally
cmds = $(patsubst %,.%.cmd,$(objs) $(othergen))
Expand All @@ -87,7 +96,7 @@ EXTRA_CFLAGS += -DPVFS2_VERSION="\"@PVFS2_VERSION@\""
#EXTRA_CFLAGS += -DPVFS2_KERNEL_DEBUG

obj-m += pvfs2.o
pvfs2-objs := $(objs) $(relative_src_dir)/lib/libkpvfs2.a
pvfs2-objs := $(objs)

else

Expand All @@ -99,16 +108,22 @@ PWD := $(shell pwd)
default: links
$(E)$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

# link to real source directory if out-of-tree build
# link to real source directory if out-of-tree build, and in-tree for
# sources from src/io/description
links:
$(E)for i in $(csrc) $(hsrc); do \
if [ ! -f $$i -a ! -L $$i ] ; then \
ln -s $(relative_src_dir)/$(here)/$$i ;\
fi ;\
done
$(E)for i in $(desc_csrc); do \
if [ ! -f $$i -a ! -L $$i ] ; then \
ln -s $(relative_src_dir)/$(desc_here)/$$i ;\
fi ;\
done

clean:
$(E)for i in $(csrc) $(hsrc); do \
$(E)for i in $(csrc) $(hsrc) $(desc_csrc); do \
if [ -L $$i ] ; then \
rm -f $$i ;\
fi ;\
Expand Down

0 comments on commit a57a123

Please sign in to comment.