-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
101 lines (80 loc) · 2.84 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
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
################################################################################
#
# aQuantia Ethernet Controller AQtion Linux Driver
# Copyright(c) 2014-2018 aQuantia Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope 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/>.
#
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
#
# Contact Information: <rdc-drv@aquantia.com>
# aQuantia Corporation, 91 E. Tasman Dr. Suite 100, San Jose, CA 95134, USA
#
################################################################################
#
# Makefile for the AQtion(tm) Ethernet driver
#
TARGET := atlantic
ifndef CC
CC = gcc
endif
export DEBIAN=`/usr/bin/dpkg --search /usr/bin/dpkg >/dev/null 2>&1 && echo 1 || echo 0`
export KO_EXISTS=`cat /etc/modules 2>/dev/null | grep atlantic && echo 1 || echo 0`
ifeq "$(CC)" "gcc"
ccflags-y := -Wall -DPCI_DEBUG
endif
ifeq "$(CC)" "clang-3.5"
ccflags-y := -Wno-date-time -W --system-header-prefix=linux/ \
-fsanitize=integer,address,undefined,alignment,bool,bounds,null,\
enum,integer-divide-by-zero,shift,unreachable,unsigned-integer-overflow
endif
CFLAGS_aq_trace.o:=-I$(src)
ifneq ($(KERNELRELEASE),)
$(TARGET)-objs:=aq_main.o aq_nic.o aq_pci_func.o aq_nic.o aq_vec.o aq_ring.o aq_ptp.o aq_filters.o \
aq_hw_utils.o aq_ethtool.o aq_drvinfo.o hw_atl/hw_atl_a0.o hw_atl/hw_atl_b0.o hw_atl/hw_atl_utils.o\
hw_atl/hw_atl_utils_fw2x.o aq_trace.o aq_phy.o\
hw_atl/hw_atl_llh.o
obj-m:=$(TARGET).o
else
ifndef KDIR
BUILD_DIR:=/lib/modules/$(shell uname -r)/build
else
BUILD_DIR:=$(KDIR)
endif
PWD:=$(shell pwd)
all:
$(MAKE) -j4 CC=$(CC) -C $(BUILD_DIR) M=$(PWD) modules
dox: .doxygen
@doxygen $<
clean:
$(MAKE) -j4 -C $(BUILD_DIR) M=$(PWD) clean
@-rm -rdf doc/html 2 > /dev/null
load:
insmod ./$(TARGET).ko
unload:
rmmod ./$(TARGET).ko
install:
@install -D -m 644 ${TARGET}.ko /lib/modules/$(shell uname -r)/updates/drivers/net/ethernet/aquantia/atlantic/${TARGET}.ko
@depmod -a $(shell uname -r)
@if [ "${DEBIAN}" = "1" ]; then \
update-initramfs -u ; \
if [ "${KO_EXISTS}" = "0" ]; then echo atlantic >> /etc/modules ; fi; \
else \
dracut --force ; \
fi
uninstall:
@if [ "${KO_EXISTS}" != "0" ]; then sed -in '/$TARGET/d' /etc/modules ; fi
@rm -f /lib/modules/$(shell uname -r)/updates/drivers/net/ethernet/aquantia/atlantic/${TARGET}.ko
@depmod -a $(shell uname -r)
endif