#!/usr/bin/make -f ########################################################## # Copyright (C) 1998 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 # ########################################################## vm_check_build = $(shell if $(CC) $(CC_OPTS) $(INCLUDE) -Werror -S -o /dev/null -xc $(1) \ > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi) DRIVERNAME := $(DRIVER)-xxx-$(VM_UNAME) ifneq (,$(filter x86_64%, $(shell $(CC) -dumpmachine))) MACHINE := x86_64 else MACHINE := x386 endif CC_WARNINGS := -Wall -Wstrict-prototypes # Don't use -pipe or egcs-2.91.66 (shipped with RedHat) will die CC_OPTS := -D__KERNEL__ -DMODULE -fomit-frame-pointer -fno-strength-reduce \ -fno-common -DKBUILD_MODNAME=$(DRIVER) # Gcc 3.0 deprecates -m486 --hpreg CC_OPTS += $(call vm_check_gcc,-falign-loops=2 -falign-jumps=2 -falign-functions=2, \ -malign-loops=2 -malign-jumps=2 -malign-functions=2) CC_OPTS += $(call vm_check_gcc,-fno-strict-aliasing,) ifeq ($(MACHINE),x86_64) CC_OPTS += -mno-red-zone -mcmodel=kernel else CC_OPTS += -DCPU=586 $(call check_gcc,-march=i586,-m486) endif INCLUDE := -I. -I$(HEADER_DIR) INCLUDE += $(shell $(CC) $(INCLUDE) -E geninclude.c \ | sed -n -e 's!^APATH!-I$(HEADER_DIR)/asm!p') CFLAGS := -O $(CC_WARNINGS) $(CC_OPTS) $(INCLUDE) $(GLOBAL_DEFS) OBJS := driver.o hub.o userif.o netif.o bridge.o procfs.o smac_compat.o \ smac.o vnetEvent.o vnetUserListener.o LIBS := default: all all: $(DRIVER).o $(DRIVERNAME): $(OBJS) $(LD) -r -o $@ $^ $(DRIVER) $(DRIVER).o ../$(DRIVER).o: $(DRIVERNAME) cp -f $< $@ auto-build: ../$(DRIVER).o clean: rm -f $(DRIVERNAME) $(DRIVER) $(DRIVER).o ../$(DRIVER).o $(OBJS) .PHONY: default all auto-build clean .SILENT: