# HG changeset patch # User hahn@xxxxxxxxxxxxxxxx # Date 1158913773 -7200 # Node ID 964994e5d7961673e1bd26e65b141186c0aab11f # Parent 8374be07c6226cac672a87f6e259b48ac5129f3b Added functionality to generate symbols from C-source for assembling. See GEN_ASSYM_... stuff. Signed-off-by: Dietmar Hahn diff -r 8374be07c622 -r 964994e5d796 extras/mini-os/Makefile --- a/extras/mini-os/Makefile Fri Sep 22 08:50:02 2006 +0200 +++ b/extras/mini-os/Makefile Fri Sep 22 10:29:33 2006 +0200 @@ -29,6 +29,12 @@ TARGET_ARCH_DIR = $(TARGET_ARCH) # This is used for architecture specific links. ARCH_LINKS = +# Initialization for generating assymbler symbols from C-source. +GEN_ASSYM_DIR=genassym +GEN_ASSYM_BIN=$(GEN_ASSYM_DIR)/gen_assym +GEN_ASSYM_H=$(GEN_ASSYM_DIR)/assym_$(TARGET_ARCH).h +DO_GEN_ASSYM= + ifeq ($(TARGET_ARCH),x86_32) CFLAGS += -m32 -march=i686 LDFLAGS += -m elf_i386 @@ -59,6 +65,7 @@ ASFLAGS += -x assembler-with-cpp -ansi - ASFLAGS += -x assembler-with-cpp -ansi -Wall ASFLAGS += -mfixed-range=f12-f15,f32-f127 ARCH_LINKS = IA64_LINKS # Special link on ia64 needed +DO_GEN_ASSYM=genassym_ia64 define arch_links [ -e include/ia64/asm-xsi-offsets.h ] || ln -sf ../../../../xen/include/asm-ia64/asm-xsi-offsets.h include/ia64/asm-xsi-offsets.h endef @@ -70,9 +77,6 @@ CFLAGS += -O3 CFLAGS += -O3 endif -# Add the special header directories to the include paths. -extra_incl := $(foreach dir,$(EXTRA_INC),-Iinclude/$(dir)) -override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH_DIR) $(extra_incl) TARGET := mini-os @@ -105,11 +109,31 @@ ifneq ($(ARCH_LINKS),) $(arch_links) endif +# Generate assymbler symbols from C-source. +ifneq ($(DO_GEN_ASSYM),) + +$(DO_GEN_ASSYM): $(GEN_ASSYM_H) + +$(GEN_ASSYM_H): $(GEN_ASSYM_BIN) + +$(GEN_ASSYM_BIN): $(HDRS) $(GEN_ASSYM_BIN)_$(TARGET_ARCH).c + rm -f $(GEN_ASSYM_H) + cc -o $@ $(CFLAGS) $(CPPFLAGS) $(GEN_ASSYM_BIN)_$(TARGET_ARCH).c + $(GEN_ASSYM_BIN) > $(GEN_ASSYM_H) + +CPPFLAGS += -I$(GEN_ASSYM_DIR) +endif + +# Add the special header directories to the include paths. +extra_incl := $(foreach dir,$(EXTRA_INC),-Iinclude/$(dir)) +override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH_DIR) $(extra_incl) + + .PHONY: links links: $(ARCH_LINKS) [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen -libminios.a: links $(OBJS) $(HEAD) +libminios.a: links $(DO_GEN_ASSYM) $(OBJS) $(HEAD) $(AR) r libminios.a $(HEAD) $(OBJS) $(TARGET): libminios.a $(HEAD) @@ -122,6 +146,8 @@ clean: rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz rm -f libminios.a find . -type l | xargs rm -f + rm -f $(GEN_ASSYM_BIN) + rm -f $(GEN_ASSYM_H) %.o: %.c $(HDRS) Makefile $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@