-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
69 lines (58 loc) · 2.63 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
60
61
62
63
64
65
66
67
68
69
# -*-Makefile-*-
# Copyright (C) 2008
# The ACX100 Open Source Project <acx100-devel@lists.sourceforge.net>
#
# 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, see <http://www.gnu.org/licenses/>.
#
# This makefile, allows compiling driver either inside or outside the kernel
# tree without further modifications.
#
# Please read the INSTALL file for further information.
ifneq ($(KERNELRELEASE),)
# If KERNELRELEASE is defined, we've been invoked from the kernel build system
# and can use its language (this variable can only be set only from the top
# level Makefile of the source tree). We simply have to declare the modules and
# leave the rest to the kernel build system.
obj-$(CONFIG_ACX_MAC80211) += acx-mac80211.o
acx-mac80211-obj-$(CONFIG_ACX_MAC80211_PCI) += pci.o
acx-mac80211-obj-$(CONFIG_ACX_MAC80211_USB) += usb.o
acx-mac80211-obj-$(CONFIG_ACX_MAC80211_MEM) += mem.o
acx-mac80211-objs := common.o $(acx-mac80211-obj-y)
else
# Otherwise we were called directly from the command line: the kernel build
# system must be explicitly invoked.
EXTRA_KCONFIG?= \
CONFIG_ACX_MAC80211=m \
CONFIG_ACX_MAC80211_PCI=y \
CONFIG_ACX_MAC80211_USB=y \
CONFIG_ACX_MAC80211_MEM=n
EXTRA_CFLAGS:= \
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG))))
PWD := $(shell pwd)
# Get the current git HEAD short version. In case something goes wrong here, ACX_GIT_VERSION
# will be empty. This will then be handled in the source files.
ACX_GIT_VERSION ?= $(shell (test -d .git) && (git show --format="%h" HEAD |head -1))
KVERSION ?= $(shell uname -r)
KERNELDIR ?= /lib/modules/$(KVERSION)/build
all:
$(MAKE) -C $(KERNELDIR) M=$(PWD) $(EXTRA_KCONFIG) EXTRA_CFLAGS="$(EXTRA_CFLAGS) -DACX_GIT_VERSION=\\\"$(ACX_GIT_VERSION)\\\"" modules
install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
help:
$(MAKE) -C $(KERNELDIR) M=$(PWD) help
.PHONY: modules modules_install clean help
endif