summaryrefslogtreecommitdiff
path: root/open-vm-tools/modules/linux/vmci/Makefile.kernel
blob: 8e6e7d0b32bbcbf67b5107d85c86cb5587530a7a (plain)
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
#!/usr/bin/make -f
##########################################################
# Copyright (C) 2007,2014 VMware, Inc. All rights reserved.
#
# 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 version 2 and no 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
#
##########################################################

CC_OPTS += -DVMCI

INCLUDE += -I$(SRCROOT)/shared -I$(SRCROOT)/common -I$(SRCROOT)/linux

EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)

obj-m += $(DRIVER).o

$(DRIVER)-y := $(subst $(SRCROOT)/, , $(patsubst %.c, %.o, \
                $(wildcard $(SRCROOT)/linux/*.c $(SRCROOT)/common/*.c)))

#
# In open-vm-tools, need to compile the common sources from the shared directory.
#
DRIVERLOG   := driverLog.o
$(DRIVER)-y += $(DRIVERLOG)

VMCI_PATH  := $(shell cd $(SRCROOT) && pwd)
ifdef OVT_SOURCE_DIR
DRIVERLOG_PATH := $(OVT_SOURCE_DIR)/modules/linux/shared
else
DRIVERLOG_PATH := $(VMCI_PATH)/shared
endif

$(addprefix $(VMCI_PATH)/,$(DRIVERLOG)): $(VMCI_PATH)/%.o: $(DRIVERLOG_PATH)/%.c
	$(Q)$(rule_cc_o_c)

clean:
	rm -rf $(wildcard $(DRIVER).mod.c $(DRIVER).ko .tmp_versions \
	        Module.symvers Modules.symvers Module.markers modules.order \
		$(foreach dir,linux/ common/ \
		./,$(addprefix $(dir),.*.cmd .*.o.flags *.o)))
ifneq ($(MODULEBUILDDIR),)
	rm -f $(MODULEBUILDDIR)/VMwareVMCIModule.symvers
endif

#
# If this build generated a Module.symvers, copy it to a public place where
# the vSockets build will be able to find it.
#
postbuild::
ifeq ($(call vm_check_file,$(SRCROOT)/Module.symvers), yes)
ifneq ($(MODULEBUILDDIR),)
	cp -f $(SRCROOT)/Module.symvers $(MODULEBUILDDIR)/VMwareVMCIModule.symvers
endif
endif