diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-05-15 16:32:09 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-05-15 16:32:09 +0100 |
commit | 395112e684108eadf6a20f3f0bfb5227a142c7aa (patch) | |
tree | 628116f911afba841785f588333568dc6e7a2d0f /extras/mini-os/Makefile | |
parent | c60d2bbfac66500f28217f0f7f3d40e4f74fb6c4 (diff) | |
download | xen-395112e684108eadf6a20f3f0bfb5227a142c7aa.tar.gz xen-395112e684108eadf6a20f3f0bfb5227a142c7aa.tar.bz2 xen-395112e684108eadf6a20f3f0bfb5227a142c7aa.zip |
Allow linking of mini-os with application-specific object code.
From: Jacob Gorm Hansen
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'extras/mini-os/Makefile')
-rw-r--r-- | extras/mini-os/Makefile | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile index 3a31e3a0d6..56eb4ff1df 100644 --- a/extras/mini-os/Makefile +++ b/extras/mini-os/Makefile @@ -6,18 +6,23 @@ include $(CURDIR)/../../Config.mk override TARGET_ARCH := $(XEN_TARGET_ARCH) # NB. '-Wcast-qual' is nasty, so I omitted it. -CFLAGS := -fno-builtin -Wall -Werror -Iinclude/ -Wredundant-decls -Wno-format +CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline +override CPPFLAGS := -Iinclude $(CPPFLAGS) +ASFLAGS = -D__ASSEMBLY__ + +LDFLAGS := -N -T minios-$(TARGET_ARCH).lds + ifeq ($(TARGET_ARCH),x86_32) CFLAGS += -m32 -march=i686 -LDFLAGS := -m elf_i386 +LDFLAGS += -m elf_i386 endif ifeq ($(TARGET_ARCH),x86_64) CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks CFLAGS += -fno-asynchronous-unwind-tables -LDFLAGS := -m elf_x86_64 +LDFLAGS += -m elf_x86_64 endif ifeq ($(debug),y) @@ -28,12 +33,12 @@ endif TARGET := mini-os -OBJS := $(TARGET_ARCH).o -OBJS += $(patsubst %.c,%.o,$(wildcard *.c)) +HEAD := $(TARGET_ARCH).o +OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c)) OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c)) OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c)) - + HDRS := $(wildcard include/*.h) HDRS += $(wildcard include/xen/*.h) @@ -44,21 +49,25 @@ default: $(TARGET) links: [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen -$(TARGET): links $(OBJS) - $(LD) -N -T minios-$(TARGET_ARCH).lds $(OBJS) -o $@.elf +libminios.a: $(OBJS) $(HEAD) + ar r libminios.a $(HEAD) $(OBJS) + +$(TARGET): links libminios.a $(HEAD) + $(LD) $(LDFLAGS) $(HEAD) -L. -lminios -o $@.elf gzip -f -9 -c $@.elf >$@.gz .PHONY: clean clean: find . -type f -name '*.o' | xargs rm -f rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz + rm -f libminios.a find . -type l | xargs rm -f %.o: %.c $(HDRS) Makefile - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ %.o: %.S $(HDRS) Makefile - $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@ + $(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@ define all_sources ( find . -follow -name SCCS -prune -o -name '*.[chS]' -print ) |