File: Makefile

package info (click to toggle)
em8300 0.16.0-2
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k
  • size: 2,024 kB
  • ctags: 1,492
  • sloc: ansic: 11,554; sh: 3,849; perl: 1,353; makefile: 429
file content (137 lines) | stat: -rw-r--r-- 4,360 bytes parent folder | download
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# $Id: Makefile,v 1.82 2006/11/26 18:39:41 nboullis Exp $
#
# Makefile -- makefile for the em8300 modules
# Copyright (C) 2004 Nicolas Boullis <nboullis@debian.org>
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

ifeq ($(KERNELRELEASE),)

KERNEL_LOCATION := /lib/modules/$(shell uname -r)/build

# If you are using external i2c modules, you should set
# EM8300_I2C_LOCATION to the source directory of the modules.
# Moreover, if the API of the modules is not properly guessed, you can
# force it by setting EM8300_I2C_FORCE_API to NEW. (That is
# especially for using 2.8.x modules with 2.4.x kernels.)
#export EM8300_I2C_LOCATION := /usr/src/modules/i2c
#export EM8300_I2C_FORCE_API := NEW

export EM8300_VERSION := "0.16.0"
export EM8300_DIR := $(CURDIR)/..
export INSTALL_MOD_DIR=em8300

build:
	$(MAKE) -C $(KERNEL_LOCATION) SUBDIRS=$(CURDIR) modules

ifeq ($(strip $(shell printf '\0043if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)\n1\n\0043else\n0\n\0043endif\n' | $(CPP) -imacros $(KERNEL_LOCATION)/include/linux/version.h -P - )),1)

clean:
	-rm -f *.o .*.o.flags

KERNVER := $(shell $(CPP) -dM $(KERNEL_LOCATION)/include/linux/version.h | sed -ne 's/^\#define[[:space:]]\+UTS_RELEASE[[:space:]]\+"\(.*\)"$$/\1/p')

MODULES := adv717x.o bt865.o em8300.o

install:
	install -d $(DESTDIR)/lib/modules/$(KERNVER)/$(INSTALL_MOD_DIR)
	install -m 644 $(MODULES) $(DESTDIR)/lib/modules/$(KERNVER)/$(INSTALL_MOD_DIR)

uninstall:
	rm -rf $(DESTDIR)/lib/modules/$(KERNVER)/$(INSTALL_MOD_DIR)

else

clean:
	$(MAKE) -C $(KERNEL_LOCATION) SUBDIRS=$(CURDIR) clean

install:
	$(MAKE) -C $(KERNEL_LOCATION) SUBDIRS=$(CURDIR) INSTALL_MOD_PATH=$(DESTDIR) modules_install

uninstall:
	rm -rf $(DESTDIR)/lib/modules/$(shell cat $(KERNEL_LOCATION)/.kernelrelease 2> /dev/null || cat $(KERNEL_LOCATION)/include/config/kernel.release 2> /dev/null)/$(INSTALL_MOD_DIR)

endif

.PHONY: build clean install uninstall

else

BUILD_IOCTL32 := n

ifeq ($(ARCH),sparc64)
BUILD_IOCTL32 := $(CONFIG_SPARC32_COMPAT)
endif

ifeq ($(ARCH),x86_64)
BUILD_IOCTL32 := $(CONFIG_IA32_EMULATION)
endif

EXTRA_CFLAGS := -I$(EM8300_DIR)/include \
		-DEM8300_VIDEOMODE_DEFAULT=EM8300_VIDEOMODE_PAL \
		-DEM8300_AUDIOMODE_DEFAULT=EM8300_AUDIOMODE_ANALOG \
		-DEM8300_VERSION=\"$(EM8300_VERSION)\" \
		-DCONFIG_ADV717X_PIXELPORT16BIT -DCONFIG_ADV717X_PIXELPORTPAL \
		-DCONFIG_EM8300_DICOMPAL -DCONFIG_EM8300_DICOMFIX \
		-DCONFIG_EM8300_DICOMCTRL
ifeq ($(BUILD_IOCTL32),y)
EXTRA_CFLAGS += -DCONFIG_EM8300_IOCTL32=1
endif
ifneq ($(EM8300_I2C_LOCATION),)
EXTRA_CFLAGS += -DCONFIG_I2C_ALGOBIT=1
# This is a hack to include i2c headers from $(EM8300_I2C_LOCATION)
# over those from the kernel source tree.
override CC += -I$(EM8300_I2C_LOCATION)
endif
ifneq ($(EM8300_I2C_FORCE_API),)
EXTRA_CFLAGS += -DEM8300_I2C_FORCE_$(EM8300_I2C_FORCE_API)_API
endif

#MOD_DESTDIR := drivers/video

em8300-objs := em8300_main.o em8300_i2c.o em8300_audio.o em8300_fifo.o \
		em8300_video.o em8300_misc.o em8300_dicom.o em8300_ucode.o \
		em8300_ioctl.o em8300_spu.o em9010.o em8300_registration.o \
		em8300_procfs.o em8300_devfs.o em8300_udev.o em8300_sysfs.o \
		em8300_alsa.o
ifeq ($(BUILD_IOCTL32),y)
em8300-objs += em8300_ioctl32.o
endif

obj-m += adv717x.o
obj-m += bt865.o
obj-m += em8300.o

# The following hack tests for old kernels (2.4 and old 2.5).
ifneq ($(TOPDIR),$(shell /bin/pwd))

EXTRA_CFLAGS += -include $(TOPDIR)/include/linux/config.h

include $(TOPDIR)/Rules.make

em8300.o: $(em8300-objs)
	$(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -r -o $@ $(em8300-objs)

else

ifeq ($(shell expr $(VERSION) \* 10000 + $(PATCHLEVEL) \* 100 + $(SUBLEVEL) \< 20615),1)

EXTRA_CFLAGS += -include $(TOPDIR)/include/linux/config.h

endif

endif

endif