Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #-------------------------------------------------------------------------------
  2. #- --
  3. #- This software is confidential and proprietary and may be used --
  4. #- only as expressly authorized by a licensing agreement from --
  5. #- --
  6. #- Hantro Products Oy. --
  7. #- --
  8. #- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. #- ALL RIGHTS RESERVED --
  10. #- --
  11. #- The entire notice above must be reproduced --
  12. #- on all copies and should not be removed. --
  13. #- --
  14. #-------------------------------------------------------------------------------
  15. #-
  16. #-- Abstract : Makefile for encoder kernel driver
  17. #--
  18. #-------------------------------------------------------------------------------
  19. ifeq ($(obj),)
  20. obj = .
  21. endif
  22. #################################################
  23. # configuration
  24. MDIR := hantro
  25. # drivers objects
  26. list-multi := hx280enc.o
  27. # what to build
  28. obj-${CONFIG_ARK_HX280ENC} := hx280enc.o
  29. tardest := .
  30. #################################################
  31. # compile modules
  32. ifneq ($(KERNELRELEASE),)
  33. # recursive call from kernel build system
  34. dummy := $(shell echo $(KERNELRELEASE) > $(obj)/.version)
  35. ifeq ($(VERSION).$(PATCHLEVEL),2.6)
  36. export-objs :=
  37. list-multi :=
  38. else
  39. multi-m := $(filter $(list-multi), $(obj-m))
  40. int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
  41. export-objs := $(filter $(int-m) $(obj-m),$(export-objs))
  42. endif
  43. CC += -I$(obj)
  44. #EXTRA_CFLAGS += -g
  45. # Print debugging messages from the device
  46. #EXTRA_CFLAGS += -DHX280ENC_DEBUG
  47. snapshot := $(wildcard $(obj)/.snapshot)
  48. ifneq ($(snapshot),)
  49. SNAPSHOT_CFLAGS := -DSNAPSHOT='$(shell cat $(snapshot))'
  50. EXTRA_CFLAGS += $(SNAPSHOT_CFLAGS)
  51. endif
  52. -include $(TOPDIR)/Rules.make
  53. else
  54. # take version info from last module build if available
  55. KERNELRELEASE := $(shell cat $(obj)/.version 2>/dev/null || uname -r)
  56. endif
  57. KDIR_BASE := /afs/hantro.com/projects/Testing/Board_Version_Control
  58. #KDIR := $(KDIR_BASE)/Realview_EB/SW/Linux/v0_0/linux-2.6.19-arm2
  59. #KDIR := $(KDIR_BASE)/Realview_EB/SW/Linux/linux-2.6.21-arm1/v0_0/linux-2.6.21-arm1
  60. #KDIR := $(KDIR_BASE)/Realview_PB/PB926EJS/SW/Linux/linux-2.6.24-arm2-spnlck/v0_1/linux-2.6.24-arm2-spnlck
  61. #KDIR := $(KDIR_BASE)/Realview_PB/PB926EJS/SW/Linux/linux-2.6.28-arm1/v0_1/linux-2.6.28-arm1
  62. KDIR := $(KDIR_BASE)/SW_Common/ARM_realview_v6/2.6.28-arm1/v0_1-v6/linux-2.6.28-arm1
  63. PWD := $(shell pwd)
  64. DEST := /lib/modules/$(KERNELRELEASE)/$(MDIR)
  65. # which files to install?
  66. inst-m := $(wildcard *.ko)
  67. ifeq ($(inst-m),)
  68. inst-m := $(obj-m)
  69. endif
  70. # locales seem to cause trouble sometimes.
  71. LC_ALL = POSIX
  72. export LC_ALL
  73. default::
  74. $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
  75. install::
  76. strip --strip-debug $(inst-m)
  77. -su -c "mkdir -p $(DEST); cp -v $(inst-m) $(DEST); depmod -a"
  78. clean::
  79. $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
  80. -rm -f .version
  81. #################################################
  82. # build tarballs
  83. thisdir := $(notdir $(PWD))
  84. name := $(shell echo $(thisdir) | sed 's/-.*//')
  85. ver := $(shell echo $(thisdir) | sed 's/.*-//')
  86. date := $(shell date +%Y%m%d)
  87. tardest ?= .
  88. snapdir := $(HOME)/snapshot
  89. snap ?= $(name)
  90. release: clean
  91. rm -f .snapshot
  92. (cd ..; tar cvzf $(tardest)/$(name)-$(ver).tar.gz $(thisdir))
  93. snapshot snap tarball: clean
  94. echo $(date) > .snapshot
  95. (cd ..; tar czf $(snapdir)/$(snap)-$(date).tar.gz $(thisdir))
  96. $(MAKE) -C $(snapdir)
  97. #################################################
  98. # other stuff
  99. %.asm: %.o
  100. objdump -S $< > $@