-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (40 loc) · 1.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# Makefile template for out of tree kernel modules
#
# PetaLinux-related stuff
ifndef PETALINUX
$(error You must source the petalinux/settings.sh script before working with PetaLinux)
endif
-include modules.common.mk
KERNEL_BUILD:=$(PROOT)/build/$(LINUX_KERNEL)
LOCALPWD=$(shell pwd)
obj-m += drivers/hwmon/ltc2990.o
all: build modules install
build:modules
.PHONY: build clean modules
clean:
make INSTANCE=$(LINUX_KERNEL) -C $(KERNEL_BUILD) M=$(LOCALPWD) clean
modules:
if [ ! -f "$(PROOT)/build/$(LINUX_KERNEL)/link-to-kernel-build/Module.symvers" ]; then \
echo "ERROR: Failed to build module ${INSTANCE} because kernel hasn't been built."; \
echo "ERROR: Please build kernel with petalinux-build -c kernel first."; \
exit 255; \
else \
make INSTANCE=$(LINUX_KERNEL) -C $(KERNEL_BUILD) M=$(LOCALPWD) modules_only; \
fi
install: $(addprefix $(DIR),$(subst .o,.ko,$(obj-m)))
if [ ! -f "$(PROOT)/build/$(LINUX_KERNEL)/link-to-kernel-build/Module.symvers" ]; then \
echo "ERROR: Failed to install module ${INSTANCE} because kernel hasn't been built."; \
echo "ERROR: Please build kernel with petalinux-build -c kernel first."; \
exit 255; \
else \
make INSTANCE=$(LINUX_KERNEL) -C $(KERNEL_BUILD) M=$(LOCALPWD) INSTALL_MOD_PATH=$(TARGETDIR) modules_install_only; \
fi
help:
@echo ""
@echo "Quick reference for various supported build targets for $(INSTANCE)."
@echo "----------------------------------------------------"
@echo " clean clean out build objects"
@echo " all build $(INSTANCE) and install to rootfs host copy"
@echo " build build subsystem"
@echo " install install built objects to rootfs host copy"