Skip to content

Commit

Permalink
Split Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeChenL committed Dec 28, 2023
1 parent 318680b commit 5407fd9
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 51 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ jobs:
run: |
case "${{ matrix.version }}" in
linux-stable)
make build -j$(nproc)
make -f DKMS.Makefile build -j$(nproc)
;;
linux-rockchip)
make build -j$(nproc) KERNEL_HEADER_VERSION=5.10.110-11-rockchip CONFIG_ARCH_MESON=n CONFIG_CPU_RK3399=rockchip CONFIG_CPU_RK3568=rockchip CONFIG_CPU_RK3588=rockchip
make -f DKMS.Makefile build -j$(nproc) KERNEL_HEADER_VERSION=5.10.110-11-rockchip CONFIG_ARCH_MESON=n CONFIG_CPU_RK3399=rockchip CONFIG_CPU_RK3568=rockchip CONFIG_CPU_RK3588=rockchip
;;
linux-rk356x)
make build -j$(nproc) KERNEL_HEADER_VERSION=5.10.160-7-rk356x CONFIG_ARCH_MESON=n CONFIG_CPU_RK3399=rockchip CONFIG_CPU_RK3568=rockchip CONFIG_CPU_RK3588=rockchip
make -f DKMS.Makefile build -j$(nproc) KERNEL_HEADER_VERSION=5.10.160-7-rk356x CONFIG_ARCH_MESON=n CONFIG_CPU_RK3399=rockchip CONFIG_CPU_RK3568=rockchip CONFIG_CPU_RK3588=rockchip
;;
esac
- name: Upload artifacts
Expand Down
50 changes: 7 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
KERNEL_HEADER_VERSION ?= $(shell uname -r)

CONFIG_CLK_RK3308 ?= rockchip
CONFIG_CLK_RK3399 ?= rockchip
CONFIG_CLK_RK3568 ?= rockchip
CONFIG_CLK_RK3588 ?= rockchip
CONFIG_ARCH_MESON ?= amlogic
include $(wildcard arch/arm64/boot/dts/*/overlays/Makefile)

DTBO-AMLOGIC := $(addprefix arch/arm64/boot/dts/amlogic/overlays/,$(dtb-amlogic))
DTBO-ROCKCHIP := $(addprefix arch/arm64/boot/dts/rockchip/overlays/,$(dtb-rockchip))
DTBO := $(DTBO-AMLOGIC) $(DTBO-ROCKCHIP)
TMP := $(addsuffix .tmp,$(DTBO))

KERNEL_HENDERS=/usr/src/linux-headers-$(shell uname -r)
ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu-
export ARCH CROSS_COMPILE

obj-m := radxa-overlays.o
all: build
$(MAKE) -C $(KERNEL_HENDERS) M=$(CURDIR) modules

cleanmodules:
$(MAKE) -C $(KERNEL_HENDERS) M=$(CURDIR) clean

#
# Build
#
.PHONY: build
build: $(DTBO)
DOCS := SOURCE
.PHONY: build-doc
build-doc: $(DOCS)

%.dtbo: %.dts
cpp -nostdinc -undef -x assembler-with-cpp -E -I "/usr/src/linux-headers-$(KERNEL_HEADER_VERSION)/include" -I "/usr/lib/modules/$(KERNEL_HEADER_VERSION)/build/include" "$<" "$@.tmp"
dtc -q -@ -I dts -O dtb -o "$@" "$@.tmp"
.PHONY: SOURCE
SOURCE:
echo -e "git clone $(shell git remote get-url origin)\ngit checkout $(shell git rev-parse HEAD)" > "$@"

#
# Clean
Expand All @@ -43,15 +15,7 @@ distclean: clean
.PHONY: clean
clean:
rm -rf $(DTBO) $(TMP)
rm -rf debian/.debhelper debian/radxa-overlays-dkms debian/debhelper-build-stamp debian/files debian/*.debhelper.log debian/*.*.debhelper debian/*.substvars radxa-overlays.ko

DOCS := SOURCE
.PHONY: build-doc
build-doc: $(DOCS)

.PHONY: SOURCE
SOURCE:
echo -e "git clone $(shell git remote get-url origin)\ngit checkout $(shell git rev-parse HEAD)" > "$@"
rm -rf debian/.debhelper debian/radxa-overlays-dkms debian/debhelper-build-stamp debian/files debian/*.debhelper.log debian/*.*.debhelper debian/*.substvars

#
# Release
Expand Down
35 changes: 35 additions & 0 deletions Makefile.dkms
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
KERNEL_HEADER_VERSION ?= $(shell uname -r)

CONFIG_CLK_RK3308 ?= rockchip
CONFIG_CLK_RK3399 ?= rockchip
CONFIG_CLK_RK3568 ?= rockchip
CONFIG_CLK_RK3588 ?= rockchip
CONFIG_ARCH_MESON ?= amlogic
include $(wildcard arch/arm64/boot/dts/*/overlays/Makefile)

DTBO-AMLOGIC := $(addprefix arch/arm64/boot/dts/amlogic/overlays/,$(dtb-amlogic))
DTBO-ROCKCHIP := $(addprefix arch/arm64/boot/dts/rockchip/overlays/,$(dtb-rockchip))
DTBO := $(DTBO-AMLOGIC) $(DTBO-ROCKCHIP)
TMP := $(addsuffix .tmp,$(DTBO))

KDIR ?= /lib/modules/$(shell uname -r)/build
ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu-
export ARCH CROSS_COMPILEs

obj-m := radxa-overlays.o
all: build
$(MAKE) -C $(KDIR) M=$(CURDIR) modules

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

#
# Build
#
.PHONY: build
build: $(DTBO)

%.dtbo: %.dts
cpp -nostdinc -undef -x assembler-with-cpp -E -I "/usr/src/linux-headers-$(KERNEL_HEADER_VERSION)/include" -I "/usr/lib/modules/$(KERNEL_HEADER_VERSION)/build/include" "$<" "[email protected]"
dtc -q -@ -I dts -O dtb -o "$@" "[email protected]"
2 changes: 0 additions & 2 deletions debian/dkms
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
PACKAGE_NAME="radxa-overlays"
PACKAGE_VERSION="#MODULE_VERSION#"
DEST_MODULE_LOCATION[0]="/updates/dkms"
MAKE="make all"
CLEAN="make clean cleanmodules"
AUTOINSTALL="yes"
2 changes: 1 addition & 1 deletion debian/install
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

arch usr/src/radxa-overlays-${DEB_VERSION}/
radxa-overlays.c usr/src/radxa-overlays-${DEB_VERSION}/
Makefile usr/src/radxa-overlays-${DEB_VERSION}/
Makefile.dkms => usr/src/radxa-overlays-${DEB_VERSION}/Makefile
35 changes: 35 additions & 0 deletions debian/tmp/dh-exec.V_yjnkis/usr/src/radxa-overlays-0.1.0/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
KERNEL_HEADER_VERSION ?= $(shell uname -r)

CONFIG_CLK_RK3308 ?= rockchip
CONFIG_CLK_RK3399 ?= rockchip
CONFIG_CLK_RK3568 ?= rockchip
CONFIG_CLK_RK3588 ?= rockchip
CONFIG_ARCH_MESON ?= amlogic
include $(wildcard arch/arm64/boot/dts/*/overlays/Makefile)

DTBO-AMLOGIC := $(addprefix arch/arm64/boot/dts/amlogic/overlays/,$(dtb-amlogic))
DTBO-ROCKCHIP := $(addprefix arch/arm64/boot/dts/rockchip/overlays/,$(dtb-rockchip))
DTBO := $(DTBO-AMLOGIC) $(DTBO-ROCKCHIP)
TMP := $(addsuffix .tmp,$(DTBO))

KDIR ?= /lib/modules/$(shell uname -r)/build
ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu-
export ARCH CROSS_COMPILEs

obj-m := radxa-overlays.o
all: build
$(MAKE) -C $(KDIR) M=$(CURDIR) modules

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

#
# Build
#
.PHONY: build
build: $(DTBO)

%.dtbo: %.dts
cpp -nostdinc -undef -x assembler-with-cpp -E -I "/usr/src/linux-headers-$(KERNEL_HEADER_VERSION)/include" -I "/usr/lib/modules/$(KERNEL_HEADER_VERSION)/build/include" "$<" "$@.tmp"
dtc -q -@ -I dts -O dtb -o "$@" "$@.tmp"
4 changes: 2 additions & 2 deletions radxa-overlays.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ static void __exit mod_exit(void)
module_init(mod_init);
module_exit(mod_exit);

MODULE_LICENSE("GPL2");
MODULE_AUTHOR("© 2022 Radxa Computer Co., Ltd");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("2022 Radxa Computer Co., Ltd");

0 comments on commit 5407fd9

Please sign in to comment.