2
##########################################################
3
# Copyright (C) 1998 VMware, Inc. All rights reserved.
5
# This program is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by the
7
# Free Software Foundation version 2 and no later version.
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# You should have received a copy of the GNU General Public License along
15
# with this program; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
##########################################################
21
#### VMware vmxnet Makefile to be distributed externally
24
vm_check_build = $(shell if $(CC) $(CC_OPTS) $(INCLUDE) -Werror -S -o /dev/null -xc $(1) \
25
> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
27
DRIVERNAME = $(DRIVER)-$(VM_UNAME)
29
ifneq (,$(filter x86_64%, $(shell $(CC) -dumpmachine)))
36
#### You must compile with at least -O level of optimization
37
#### or the module won't load.
38
#### If desparate, I think that bringing in <linux/bitops.h> might
41
CC_WARNINGS := -Wall -Wstrict-prototypes
42
# Don't use -pipe or egcs-2.91.66 (shipped with RedHat) will die
43
CC_KFLAGS := -D__KERNEL__ -fno-strength-reduce -fno-omit-frame-pointer \
44
-fno-common -DKBUILD_MODNAME=$(DRIVER)
45
CC_KFLAGS += $(call vm_check_gcc,-falign-loops=2 -falign-jumps=2 -falign-functions=2, \
46
-malign-loops=2 -malign-jumps=2 -malign-functions=2)
47
CC_KFLAGS += $(call vm_check_gcc,-fno-strict-aliasing,)
48
ifeq ($(MACHINE),x86_64)
49
CC_KFLAGS += -mno-red-zone -mcmodel=kernel
51
# Gcc 3.0 deprecates -m486 --hpreg
52
CC_KFLAGS += -DCPU=586 $(call check_gcc,-march=i586,-m486)
55
CC_OPTS := -g3 -O2 -DMODULE $(GLOBAL_DEFS) $(CC_KFLAGS) $(CC_WARNINGS)
57
INCLUDE += -I$(HEADER_DIR)
59
INCLUDE += $(shell $(CC) $(CC_OPTS) $(INCLUDE) \
60
-E $(AUTOCONF_DIR)/geninclude.c \
61
| sed -n -e 's!^APATH!-I$(HEADER_DIR)/asm!p')
64
INCLUDE += -I$(OVT_SOURCE_DIR)/modules/shared/vmxnet
67
CC_OPTS += $(call vm_check_build, $(AUTOCONF_DIR)/skblin.c, -DVMW_SKB_LINEARIZE_2618, )
71
CFLAGS := $(CC_OPTS) $(INCLUDE)
79
$(DRIVERNAME): $(OBJS)
82
$(DRIVER) ../$(DRIVER).o: $(DRIVERNAME)
85
auto-build: ../$(DRIVER).o
88
rm -f $(DRIVERNAME) ../$(DRIVERNAME) $(DRIVER) ../$(DRIVER).o $(DRIVER).o $(OBJS)