X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=Makefile;h=ed13298c414883f446c0e582a1acaad2e557d274;hb=afca783e03bd737fe7bb02d498644df30bf5d4d9;hp=3450def7d56a6163a672874eb7904fe4c29bf791;hpb=15dbc69e8f6cfe2821125700d5fb95f588a403a5;p=palacios.git diff --git a/Makefile b/Makefile index 3450def..ed13298 100644 --- a/Makefile +++ b/Makefile @@ -183,7 +183,7 @@ HOSTCC = gcc HOSTCXX = g++ 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,7 +298,12 @@ V3_INCLUDE := -Ipalacios/include \ CPPFLAGS := $(V3_INCLUDE) -D__V3VEE__ -CFLAGS := -fno-stack-protector -Wall -Werror -fPIC -mno-red-zone -fno-common +CFLAGS := -fno-stack-protector -Wall -Werror -mno-red-zone -fno-common + + + +#-ffreestanding + LDFLAGS := --whole-archive @@ -429,8 +434,12 @@ 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/ modules-y := modules/ + + ifeq ($(dot-config),1) # In this section, we need .config @@ -457,7 +466,12 @@ else palacios/include/autoconf.h: ; endif + +ifdef 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,6 +480,12 @@ DEFAULT_EXTRA_TARGETS= all: palacios $(DEFAULT_EXTRA_TARGETS) +ifdef CONFIG_LINUX +CFLAGS += -mcmodel=kernel +else +CFLAGS += -fPIC +endif + ifdef CONFIG_FRAME_POINTER CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) else @@ -480,7 +500,7 @@ endif ifdef CONFIG_DEBUG_INFO CFLAGS += -g else -CFLAGS += -O2 +CFLAGS += -O endif @@ -510,7 +530,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) $(libs-y)) $(modules-y)) + + #palacios-alldirs := $(sort $(palacios-dirs) $(patsubst %/,%,$(filter %/, \ # $(core-n) $(core-) $(devices-n) $(devices-) \ @@ -518,14 +540,19 @@ 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-) $(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)) 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)) @@ -548,9 +575,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) $(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 $@ $^ @@ -589,6 +617,18 @@ libv3vee.a: $(palacios) palacios: libv3vee.a + + + +linux_module/v3vee.ko: linux_module/*.c linux_module/*.h libv3vee.a + cd linux_module/ && make CONFIG_LINUX_KERN=$(CONFIG_LINUX_KERN) + cp linux_module/v3vee.ko v3vee.ko + + +linux_module: linux_module/v3vee.ko + + + palacios.asm: palacios $(OBJDUMP) --disassemble $< > $@ @@ -704,7 +744,7 @@ clean: archclean $(clean-dirs) @find . $(RCS_FIND_IGNORE) \ \( -name 'lib' \) -prune -o \ \( -name '*.[oas]' -o -name '.*.cmd' \ - -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ + -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