comparison driver/Makefile @ 90:c6311b6efd9c

- version string should be generated upon revision on mercurial repository - version bump to 1.1.0 on other environment
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 27 Jan 2010 16:43:03 +0900
parents c9b41c438a93
children ee357d8f987f
comparison
equal deleted inserted replaced
89:d74bcf2d255d 90:c6311b6efd9c
1 TARGET:= pt1_drv.ko 1 TARGET := pt1_drv.ko
2 VERBOSITY = 0 2 VERBOSITY = 0
3 REL_VERSION = "1.1.0"
4 REL_DATE = "2010-01-27"
3 5
4 all: ${TARGET} 6 all: ${TARGET}
5 7
6 pt1_drv.ko: pt1_pci.c pt1_i2c.c pt1_tuner.c pt1_tuner_data.c 8 pt1_drv.ko: pt1_pci.c pt1_i2c.c pt1_tuner.c pt1_tuner_data.c version.h
7 make -C /lib/modules/`uname -r`/build M=`pwd` V=$(VERBOSITY) modules 9 make -C /lib/modules/`uname -r`/build M=`pwd` V=$(VERBOSITY) modules
8 10
9 clean: 11 clean:
10 make -C /lib/modules/`uname -r`/build M=`pwd` V=$(VERBOSITY) clean 12 make -C /lib/modules/`uname -r`/build M=`pwd` V=$(VERBOSITY) clean
11 13
12 obj-m := pt1_drv.o 14 obj-m := pt1_drv.o
13 15
14 pt1_drv-objs := pt1_pci.o pt1_i2c.o pt1_tuner.o pt1_tuner_data.o 16 pt1_drv-objs := pt1_pci.o pt1_i2c.o pt1_tuner.o pt1_tuner_data.o
15 17
16 clean-files := *.o *.ko *.mod.[co] *~ 18 clean-files := *.o *.ko *.mod.[co] *~ version.h
19
20 version.h:
21 revh=`hg parents --template '#define DRV_VERSION "r{rev}:{node|short}"\n#define DRV_RELDATE "{date|shortdate}"\n' 2>/dev/null`; \
22 if [ -n "$$revh" ] ; then \
23 echo "$$revh" > $@; \
24 else \
25 printf "#define DRV_VERSION \"$(REL_VERSION)\"\n#define DRV_RELDATE \"$(REL_DATE)\"\n" > $@; \
26 fi
17 27
18 install: $(TARGET) 28 install: $(TARGET)
19 install -m 644 $(TARGET) /lib/modules/`uname -r`/kernel/drivers/video 29 install -m 644 $(TARGET) /lib/modules/`uname -r`/kernel/drivers/video
20 if [ -d /etc/udev/rules.d -a ! -f /etc/udev/rules.d/99-pt1.rules ] ; then \ 30 if [ -d /etc/udev/rules.d -a ! -f /etc/udev/rules.d/99-pt1.rules ] ; then \
21 install -m 644 etc/99-pt1.rules /etc/udev/rules.d ; \ 31 install -m 644 etc/99-pt1.rules /etc/udev/rules.d ; \