Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Makefile changes from #67 #84

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion hello-world/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
ifneq ($(KERNELRELEASE),)
obj-m := helloworld.o
helloworld-objs := target/x86_64-linux-kernel-module/debug/libhello_world.a
helloworld-objs := libhello_world.o
EXTRA_LDFLAGS += --entry=init_module

$(M)/libhello_world.o: target/x86_64-linux-kernel-module/debug/libhello_world.a
$(LD) -r -o $@ --whole-archive $^
else
KDIR ?= /lib/modules/$(shell uname -r)/build

all:
$(MAKE) -C $(KDIR) M=$(CURDIR)

clean:
$(MAKE) -C $(KDIR) M=$(CURDIR) clean
endif
8 changes: 7 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
ifneq ($(KERNELRELEASE),)
obj-m := testmodule.o
testmodule-objs := $(TEST_LIBRARY)
testmodule-objs := $(TEST_LIBRARY_OBJECT)
EXTRA_LDFLAGS += --entry=init_module

$(M)/$(TEST_LIBRARY_OBJECT): target/x86_64-linux-kernel-module/debug/$(TEST_LIBRARY_ARCHIVE)
$(LD) -r -o $@ --whole-archive $^
else
KDIR ?= /lib/modules/$(shell uname -r)/build

all:
$(MAKE) -C $(KDIR) M=$(CURDIR)

clean:
$(MAKE) -C $(KDIR) M=$(CURDIR) clean
endif
11 changes: 5 additions & 6 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ def main():
path
)
)
library_path, _ = os.path.splitext(os.path.basename(module))
library_object = library_path + ".o"
library_archive = library_path + ".a"
run(
"make", "-C", BASE_DIR,
"TEST_LIBRARY={}".format(
os.path.join(
"target/x86_64-linux-kernel-module/debug/",
os.path.basename(module)
)
),
"TEST_LIBRARY_OBJECT={}".format(library_object),
"TEST_LIBRARY_ARCHIVE={}".format(library_archive),
)
run(
"rustc",
Expand Down