forked from Manouchehri/smi2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.36 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
53
54
55
56
57
58
59
ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
smi2021-y := smi2021_main.o \
smi2021_bootloader.o \
smi2021_v4l2.o \
smi2021_audio.o \
obj-$(CONFIG_VIDEO_SMI2021) += smi2021.o
ifeq ($(GIT_VERSION),)
GIT_VERSION := $(shell cd $(src) && git show -s --format=%h)
endif
$(info ** GIT MODULE VERSION = $(GIT_VERSION) **)
ccflags-y += -Idrivers/media/i2c -DGITVERSION=\"-$(GIT_VERSION)\"
else
# normal makefile
ifeq ($(KDIR),)
KDIR := $(shell echo /lib/modules/`uname -r`/build)
else
$(info ** KDIR = $(KDIR) **)
endif
ifeq ($(ARCH),)
OVERRIDE_ARCH :=
else
OVERRIDE_ARCH := ARCH=$(ARCH)
endif
ifeq ($(CROSS_COMPILE),)
OVERRIDE_CROSS_COMPILE :=
else
OVERRIDE_CROSS_COMPILE := CROSS_COMPILE=$(CROSS_COMPILE)
endif
CURR_PWD := $(shell pwd)
export CONFIG_VIDEO_SMI2021=m
export GIT_VERSION=$(shell cd $(CURR_PWD) && git show -s --format=%h)
KCONFIG_DEF_TARGET += modules modules_install clean help
MODULE_SPECIFIC_TARGET += clean_all dsad
PHONY += $(KCONFIG_DEF_TARGET) $(MODULE_SPECIFIC_TARGET)
.PHONY: $(PHONY)
.DEFAULT_GOAL := modules
.PHONY: $(KCONFIG_DEF_TARGET)
$(KCONFIG_DEF_TARGET):
$(MAKE) $(OVERRIDE_ARCH) $(OVERRIDE_CROSS_COMPILE) -C $(KDIR) M=$(CURR_PWD) -I$(KDIR)/drivers/media/i2c $@
# Module specific targets
.PHONY: clean_all
clean_all:
-rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c modules.order Module.symvers
-rm -rf .tmp_versions
endif