-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
116 lines (94 loc) · 2.82 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/make -f
##########################################################
# Copyright (C) 2009 VMware, Inc. All rights reserved.
#
# The contents of this file are subject to the terms of the Common
# Development and Distribution License (the "License") version 1.0
# and no later version. You may not use this file except in
# compliance with the License.
#
# You can obtain a copy of the License at
# http://www.opensource.org/licenses/cddl1.php
#
# See the License for the specific language governing permissions
# and limitations under the License.
#
##########################################################
ifneq ($(shell echo "$(VM_UNAME)" | cut -c-4),5.10)
SUPPORTED := 1
endif
ifneq ($(shell echo "$(VM_UNAME)" | cut -c-4),5.11)
SUPPORTED := 1
endif
$(if $(SUPPORTED),,$(error "Unsupported Solaris version: $(VM_UNAME)"))
##
## General build locations and variables
##
MODULE := vmxnet3
CFLAGS :=
LDFLAGS :=
CFLAGS += -O2
CFLAGS += -Wall -Wno-unknown-pragmas
#CFLAGS += -U_NO_LONGLONG
CFLAGS += -D_KERNEL
#CFLAGS += -I../../../lib/include # for buildNumber.h
CFLAGS += -ffreestanding
CFLAGS += -nodefaultlibs
ifdef OVT_SOURCE_DIR
CFLAGS += -I$(OVT_SOURCE_DIR)/lib/include
CFLAGS += -I$(OVT_SOURCE_DIR)/modules/shared/vmxnet
endif
CFLAGS_32 := $(CFLAGS)
CFLAGS_32 += -m32
LDFLAGS_32 := $(LDFLAGS)
CFLAGS_64 := $(CFLAGS)
CFLAGS_64 += -m64
CFLAGS_64 += -mcmodel=kernel
CFLAGS_64 += -mno-red-zone
LDFLAGS_64 := $(LDFLAGS)
ifdef HAVE_GNU_LD
LDFLAGS_64 += -m elf_x86_64
else
LDFLAGS_64 += -64
endif
##
## Objects needed to build the HGFS kernel module
##
VMXNET3_OBJS := vmxnet3_main.o
VMXNET3_OBJS += vmxnet3_utils.o
VMXNET3_OBJS += vmxnet3_tx.o
VMXNET3_OBJS += vmxnet3_rx.o
VMXNET3_32_OBJS := $(addprefix i386/, $(VMXNET3_OBJS))
VMXNET3_64_OBJS := $(addprefix amd64/, $(VMXNET3_OBJS))
MODULE_32 := i386/$(MODULE)
MODULE_64 := amd64/$(MODULE)
all: prepare_dirs $(MODULE_32) $(MODULE_64)
prepare_dirs:
@echo "Creating build directories"
mkdir -p i386
mkdir -p amd64
$(MODULE_32): $(VMXNET3_32_OBJS)
@echo "Linking $@"
$(LD) $(LDFLAGS_32) -r $(VMXNET3_32_OBJS) -o $@
$(VMXNET3_32_OBJS): i386/%.o: %.c
@echo "Compiling $(<F)"
$(CC) $(CFLAGS_32) -c $< -o $@
$(MODULE_64): $(VMXNET3_64_OBJS)
@echo "Linking $@"
$(LD) $(LDFLAGS_64) -r $(VMXNET3_64_OBJS) -o $@
$(VMXNET3_64_OBJS): amd64/%.o: %.c
@echo "Compiling $(<F)"
$(CC) $(CFLAGS_64) -c $< -o $@
clean:
@echo "Cleaning directories"
@rm -rf $(MODULE_32) $(VMXNET3_32_OBJS) i386
@rm -rf $(MODULE_64) $(VMXNET3_64_OBJS) amd64
install:
@echo "Installing modules"
cp $(MODULE_32) /kernel/drv/
chmod 755 /kernel/drv/$(MODULE)
cp $(MODULE_64) /kernel/drv/amd64
chmod 755 /kernel/drv/amd64/$(MODULE)
cp vmxnet3s.conf /kernel/drv/vmxnet3s.conf
chmod 644 /kernel/drv/vmxnet3s.conf
add_drv -i "pciex15ad,7b0" vmxnet3s