X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=Makefile;h=f483b058cf16bd841dc6041ea5b767de9878af55;hp=51c03e9e6ff86699310c3d409e7578bf7eb447dd;hb=d0aa5bd27c22a33f04f47363910f9773fdeab7eb;hpb=4cc3e8965ada59e7f5a9e55e8ccbc9563d997b93 diff --git a/Makefile b/Makefile index 51c03e9..f483b05 100644 --- a/Makefile +++ b/Makefile @@ -181,9 +181,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ +HOSTCFLAGS = -Wall -Wstrict-prototypes -fomit-frame-pointer \ -Wno-unused -Wno-format-security -U_FORTIFY_SOURCE -HOSTCXXFLAGS = -O2 +HOSTCXXFLAGS = -O # Decide whether to build built-in, modular, or both. # Normally, just do built-in. @@ -298,9 +298,22 @@ V3_INCLUDE := -Ipalacios/include \ CPPFLAGS := $(V3_INCLUDE) -D__V3VEE__ -CFLAGS := -fno-stack-protector -Wall -O -Werror -fPIC -mno-red-zone +# +# We want no-strict-aliasing here whether or not the target kernel +# has it configued. See Linus's rant about gcc's "if the standard +# says we can do anything, we will do the wrong thing" behavior with +# regard to this option +# +CFLAGS := -fno-stack-protector -Wall -Werror -mno-red-zone -fno-common \ + -fno-strict-aliasing -ffreestanding \ + $(call cc-option, -Wno-unused-but-set-variable,) + + -LDFLAGS := --whole-archive +#-ffreestanding + + +LDFLAGS := --whole-archive ifeq ($(call cc-option-yn, -fgnu89-inline),y) CFLAGS += -fgnu89-inline @@ -374,9 +387,9 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) endif ifeq ($(KBUILD_EXTMOD),) - ifneq ($(filter config %config,$(MAKECMDGOALS)),) + ifneq ($(filter %config,$(MAKECMDGOALS)),) config-targets := 1 - ifneq ($(filter-out config %config,$(MAKECMDGOALS)),) + ifneq ($(filter-out %config,$(MAKECMDGOALS)),) mixed-targets := 1 endif endif @@ -402,7 +415,7 @@ ifeq ($(config-targets),1) include $(srctree)/Makefile.$(ARCH) export KBUILD_DEFCONFIG -config %config: scripts_basic outputmakefile FORCE +%config: scripts_basic outputmakefile FORCE $(Q)mkdir -p palacios/include/config $(Q)$(MAKE) $(build)=scripts/kconfig $@ # $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease @@ -429,8 +442,14 @@ scripts_basic: palacios/include/autoconf.h core-y := palacios/src/palacios/ libs-y := palacios/lib/$(ARCH)/ devices-y := palacios/src/devices/ +interfaces-y := palacios/src/interfaces/ +extensions-y := palacios/src/extensions/ +vnet-y := palacios/src/vnet/ +gears-y := palacios/src/gears/ modules-y := modules/ + + ifeq ($(dot-config),1) # In this section, we need .config @@ -457,7 +476,12 @@ else palacios/include/autoconf.h: ; endif + +ifdef V3_CONFIG_LINUX +DEFAULT_EXTRA_TARGETS=linux_module +else DEFAULT_EXTRA_TARGETS= +endif # The all: target is the default when no target is given on the # command line. @@ -466,18 +490,24 @@ DEFAULT_EXTRA_TARGETS= all: palacios $(DEFAULT_EXTRA_TARGETS) -ifdef CONFIG_FRAME_POINTER +ifdef V3_CONFIG_LINUX +CFLAGS += -mcmodel=kernel +else +CFLAGS += -fPIC +endif + +ifdef V3_CONFIG_FRAME_POINTER CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) else CFLAGS += -fomit-frame-pointer endif -ifdef CONFIG_UNWIND_INFO +ifdef V3_CONFIG_UNWIND_INFO CFLAGS += -fasynchronous-unwind-tables endif -ifdef CONFIG_DEBUG_INFO +ifdef V3_CONFIG_DEBUG_INFO CFLAGS += -g endif @@ -491,6 +521,8 @@ NOSTDINC_FLAGS += # disable pointer signedness warnings in gcc 4.0 CFLAGS += $(call cc-option,-Wno-pointer-sign,) +CFLAGS += -O + # Default kernel image to build when no specific target is given. # KBUILD_IMAGE may be overruled on the commandline or # set in the environment @@ -508,7 +540,9 @@ export INSTALL_PATH ?= /build palacios-dirs := $(patsubst %/,%,$(filter %/, \ - $(core-y) $(devices-y) $(libs-y)) $(modules-y)) + $(core-y) $(devices-y) $(interfaces-y) $(extensions-y) $(vnet-y) $(gears-y) $(libs-y)) $(modules-y)) + + #palacios-alldirs := $(sort $(palacios-dirs) $(patsubst %/,%,$(filter %/, \ # $(core-n) $(core-) $(devices-n) $(devices-) \ @@ -516,14 +550,21 @@ palacios-dirs := $(patsubst %/,%,$(filter %/, \ palacios-cleandirs := $(sort $(palacios-dirs) $(patsubst %/,%,$(filter %/, \ - $(core-n) $(core-) $(devices-n) $(devices-) $(modules-n) $(modules-)))) + $(core-n) $(core-) $(devices-n) $(devices-) \ + $(interfaces-n) $(interfaces-) $(extensions-n) $(extensions-) $(vnet-n) $(vnet-) $(gears-n) $(gears-) $(modules-n) $(modules-)))) core-y := $(patsubst %/, %/built-in.o, $(core-y)) devices-y := $(patsubst %/, %/built-in.o, $(devices-y)) +interfaces-y := $(patsubst %/, %/built-in.o, $(interfaces-y)) +extensions-y := $(patsubst %/, %/built-in.o, $(extensions-y)) libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) +vnet-y := $(patsubst %/, %/built-in.o, $(vnet-y)) +gears-y := $(patsubst %/, %/built-in.o, $(gears-y)) modules-y := $(patsubst %/, %/built-in.o, $(modules-y)) +#lnxmod-y := $(patsubst %/, %/built-in.o, $(lnxmod-y)) + #core-y := $(patsubst %/, %/lib.a, $(core-y)) #devices-y := $(patsubst %/, %/lib.a, $(devices-y)) @@ -546,9 +587,10 @@ modules-y := $(patsubst %/, %/built-in.o, $(modules-y)) -palacios := $(core-y) $(devices-y) $(libs-y) $(modules-y) +palacios := $(core-y) $(devices-y) $(interfaces-y) $(extensions-y) $(vnet-y) $(gears-y) $(libs-y) $(modules-y) + -# Rule to link palacios - also used during CONFIG_KALLSYMS +# Rule to link palacios - also used during CONFIG_CONFIGKALLSYMS # May be overridden by /Makefile.$(ARCH) quiet_cmd_palacios__ ?= AR $@ cmd_palacios__ ?= $(AR) rcs $@ $^ @@ -587,6 +629,18 @@ libv3vee.a: $(palacios) palacios: libv3vee.a + + + +linux_module/v3vee.ko: linux_module/*.c linux_module/*.h libv3vee.a + cd linux_module/ && make -j 8 + cp linux_module/v3vee.ko v3vee.ko + + +linux_module: linux_module/v3vee.ko + + + palacios.asm: palacios $(OBJDUMP) --disassemble $< > $@ @@ -682,6 +736,9 @@ MRPROPER_FILES += .config .config.old .version .old_version \ tags TAGS cscope* +# \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ + + # clean - Delete most, but leave enough to build external modules # clean: rm-dirs := $(CLEAN_DIRS) @@ -692,13 +749,14 @@ PHONY += $(clean-dirs) clean archclean $(clean-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) + clean: archclean $(clean-dirs) $(call cmd,rmdirs) $(call cmd,rmfiles) @find . $(RCS_FIND_IGNORE) \ \( -name 'lib' \) -prune -o \ - \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ - -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ + \( -name '*.[oas]' -o -name '.*.cmd' \ + -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' -o -name '*.ko' \) \ -type f -print | xargs rm -f # mrproper - Delete all generated files, including .config @@ -814,7 +872,7 @@ endif ALLSOURCE_ARCHS := $(ARCH) define all-sources - ( find $(__srctree)/palacios $(RCS_FIND_IGNORE) \ + ( find $(__srctree)palacios $(RCS_FIND_IGNORE) \ \( -name lib \) -prune -o \ -name '*.[chS]' -print; ) endef @@ -894,11 +952,11 @@ target-dir = $(dir $@) $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) # Modules -/ %/: prepare scripts FORCE - $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ +%/: prepare scripts FORCE + $(Q)$(MAKE) KBUILD_MODULES=$(if $(V3_CONFIG_MODULES),1) \ $(build)=$(build-dir) %.ko: prepare scripts FORCE - $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ + $(Q)$(MAKE) KBUILD_MODULES=$(if $(V3_CONFIG_MODULES),1) \ $(build)=$(build-dir) $(@:.ko=.o) $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost