📄 makefile
字号:
DEBUG = 0
OBJS := viafbdev.o hw.o iface.o tv.o via_i2c.o vt1622.o vt1622a.o dvi.o lcd.o
SRC = viafbdev.c hw.c iface.c tv.c via_i2c.c vt1622.c vt1622a.c dvi.c lcd.c
TARGET = viafb.o
INSTALL_PATH:=/lib/modules/$(shell uname -r)/kernel/drivers/video
KSP := /lib/modules/$(shell uname -r)/build
test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
KSP := $(foreach dir, $(KSP), $(test_dir))
KSRC := $(firstword $(KSP))
ifeq (,$(KSRC))
$(error Linux kernel source not found)
endif
VERSION_FILE := $(KSRC)/include/linux/version.h
CONFIG_FILE := $(KSRC)/include/linux/config.h
ifeq (,$(wildcard $(VERSION_FILE)))
$(error Linux kernel source not configured - missing version.h)
endif
ifeq (,$(wildcard $(CONFIG_FILE)))
$(error Linux kernel source not configured - missing config.h)
endif
ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
CC := kgcc gcc cc
else
CC := gcc cc
endif
test_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc))
CC := $(foreach cc, $(CC), $(test_cc))
CC := $(firstword $(CC))
CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -O2 -pipe
CFLAGS += -I$(KSRC)/include -I. -Wstrict-prototypes -fomit-frame-pointer
CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h")
KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | grep UTS_RELEASE | \
awk '{ print $$3 }' | sed 's/\"//g')
KERVER2=$(shell uname -r | cut -d. -f2)
.SILENT: $(TARGET) clean
ifeq ($(TARGET), viafb.o)
ifneq ($(KVER),$(shell uname -r))
$(warning ***)
$(warning *** Warning: kernel source version ($(KVER)))
$(warning *** does not match running kernel ($(shell uname -r)))
$(warning *** Continuing with build,)
$(warning *** resulting driver may not be what you want)
$(warning ***)
endif
endif
ifeq ($(DEBUG), 1)
CFLAGS += -DRHINE_DBG
endif
#ifeq ($(TARGET), viafb.o)
#ifneq ($(SMP),$(shell uname -a | grep SMP > /dev/null 2>&1 && echo 1 || echo 0))
# $(warning ***)
#ifeq ($(SMP),1)
# $(warning *** Warning: kernel source configuration (SMP))
# $(warning *** does not match running kernel (UP))
#else
# $(warning *** Warning: kernel source configuration (UP))
# $(warning *** does not match running kernel (SMP))
#endif
# $(warning *** Continuing with build,)
# $(warning *** resulting driver may not be what you want)
# $(warning ***)
#endif
#endif
ifeq ($(SMP), 1)
CFLAGS += -D__SMP__
endif
$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o))
$(LD) -r $^ -o $@
echo; echo
echo "**************************************************"
echo "Build options:"
echo " VERSION $(KVER)"
echo " Viafb module was successfully compiled"
install:
rm -f /etc/fb.modes
cp viafb.modes /etc/fb.modes
@cp -v viafb.o $(INSTALL_PATH)/ ; \
depmod -a
clean:
rm -f $(TARGET) $(SRC:.c=.o) *~
-include .depend.mak
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -