~ubuntu-branches/ubuntu/oneiric/open-vm-tools/oneiric

« back to all changes in this revision

Viewing changes to modules/linux/vmmemctl/Makefile.normal

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-10-18 12:28:19 UTC
  • mfrom: (1.1.7 upstream) (2.4.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091018122819-00vqew6m0ztpqcqp
Tags: 2009.10.15-201664-1
MergingĀ upstreamĀ versionĀ 2009.10.15-201664.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/make -f
2
 
##########################################################
3
 
# Copyright (C) 1998 VMware, Inc. All rights reserved.
4
 
#
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.
8
 
#
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
12
 
# for more details.
13
 
#
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
17
 
#
18
 
##########################################################
19
 
 
20
 
####
21
 
####  VMware vmmemctl Makefile to be distributed externally
22
 
####
23
 
 
24
 
vm_check_build = $(shell if $(CC) $(CC_OPTS) $(INCLUDE) \
25
 
        -Werror -S -o /dev/null -xc $(1) \
26
 
        > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
27
 
 
28
 
DRIVERNAME = $(DRIVER)-$(VM_UNAME)
29
 
 
30
 
ifneq (,$(filter x86_64%, $(shell $(CC) -dumpmachine)))
31
 
MACHINE := x86_64
32
 
else
33
 
MACHINE := x386
34
 
endif
35
 
 
36
 
####
37
 
#### You must compile with at least -O level of optimization
38
 
#### or the module won't load.
39
 
#### If desparate, I think that bringing in <linux/bitops.h> might
40
 
#### suffice.
41
 
####
42
 
CC_WARNINGS := -Wall -Wstrict-prototypes
43
 
# Don't use -pipe or egcs-2.91.66 (shipped with RedHat) will die
44
 
CC_KFLAGS := -D__KERNEL__ -fno-strength-reduce -fno-omit-frame-pointer \
45
 
             -fno-common -DKBUILD_MODNAME=$(DRIVER)
46
 
CC_KFLAGS += $(call vm_check_gcc,-falign-loops=2 -falign-jumps=2 -falign-functions=2, \
47
 
             -malign-loops=2 -malign-jumps=2 -malign-functions=2)
48
 
CC_KFLAGS += $(call vm_check_gcc,-fno-strict-aliasing,)
49
 
ifeq ($(MACHINE),x86_64)
50
 
CC_KFLAGS += -mno-red-zone -mcmodel=kernel
51
 
else
52
 
# Gcc 3.0 deprecates -m486 --hpreg
53
 
CC_KFLAGS += -DCPU=586 $(call check_gcc,-march=i586,-m486)
54
 
endif
55
 
 
56
 
INCLUDE += -I$(HEADER_DIR)
57
 
ifeq ($(USE_SHARED_DIR),1)
58
 
INCLUDE += -I$(call VMLIB_PATH,backdoor)
59
 
endif
60
 
 
61
 
 
62
 
INCLUDE += $(shell $(CC) $(CC_OPTS) $(INCLUDE) \
63
 
           -E $(AUTOCONF_DIR)/geninclude.c \
64
 
           | sed -n -e 's!^APATH!-I$(HEADER_DIR)/asm!p')
65
 
 
66
 
CC_OPTS := -g3 -O2 -DMODULE $(GLOBAL_DEFS) $(CC_KFLAGS) $(CC_WARNINGS)
67
 
CC_OPTS += $(call vm_check_build, $(AUTOCONF_DIR)/epoll.c,   -DVMW_HAVE_EPOLL, )
68
 
CC_OPTS += $(call vm_check_build, $(AUTOCONF_DIR)/setnice.c, -DVMW_HAVE_SET_USER_NICE, )
69
 
 
70
 
OBJS += os.o
71
 
OBJS += vmballoon.o
72
 
 
73
 
ifeq ($(MACHINE),x86_64)
74
 
OBJS += backdoorGcc64.o
75
 
else
76
 
OBJS += backdoorGcc32.o
77
 
endif
78
 
 
79
 
CFLAGS := $(CC_OPTS) $(INCLUDE)
80
 
 
81
 
LIBS :=
82
 
 
83
 
default: all
84
 
 
85
 
#
86
 
# In open-vm-tools, need to compile the common sources from the lib directory.
87
 
#
88
 
ifdef OVT_SOURCE_DIR
89
 
LIBBACKDOOR_PATH := $(call VMLIB_PATH,backdoor)
90
 
 
91
 
INCLUDE          += -I$(LIBBACKDOOR_PATH)
92
 
 
93
 
LIBBACKDOOR      := backdoorGcc32.o
94
 
LIBBACKDOOR      += backdoorGcc64.o
95
 
 
96
 
$(LIBBACKDOOR): %.o: $(LIBBACKDOOR_PATH)/%.c
97
 
        $(CC) $(CC_OPTS) $(INCLUDE) -c $<
98
 
endif
99
 
 
100
 
all: ../$(DRIVER).o
101
 
 
102
 
$(DRIVERNAME): $(OBJS)
103
 
        $(LD) -r -o $@ $^
104
 
 
105
 
$(DRIVER) $(DRIVER).o ../$(DRIVER).o: $(DRIVERNAME)
106
 
        cp -f $< $@
107
 
 
108
 
auto-build: ../$(DRIVER).o
109
 
 
110
 
clean:
111
 
        rm -f $(DRIVERNAME) ../$(DRIVERNAME) $(DRIVER) $(DRIVER).o ../$(DRIVER).o $(OBJS)
112
 
 
113
 
.SILENT: