ia64/xen-unstable

view extras/mini-os/Makefile @ 17022:fbbc0523779e

ioemu stubdom: make daemonize optional
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Feb 11 10:03:48 2008 +0000 (2008-02-11)
parents 80e177b12fd2
children a905c582a406
line source
1 # Common Makefile for mini-os.
2 #
3 # Every architecture directory below mini-os/arch has to have a
4 # Makefile and a arch.mk.
5 #
7 XEN_ROOT = ../..
8 include $(XEN_ROOT)/Config.mk
10 XEN_INTERFACE_VERSION := 0x00030205
11 export XEN_INTERFACE_VERSION
13 # Set TARGET_ARCH
14 override TARGET_ARCH := $(XEN_TARGET_ARCH)
16 # Set mini-os root path, used in mini-os.mk.
17 MINI-OS_ROOT=$(PWD)
18 export MINI-OS_ROOT
20 # Try to find out the architecture family TARGET_ARCH_FAM.
21 # First check whether x86_... is contained (for x86_32, x86_32y, x86_64).
22 # If not x86 then use $(TARGET_ARCH) -> for ia64, ...
23 ifeq ($(findstring x86_,$(TARGET_ARCH)),x86_)
24 TARGET_ARCH_FAM = x86
25 else
26 TARGET_ARCH_FAM = $(TARGET_ARCH)
27 endif
29 # The architecture family directory below mini-os.
30 TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FAM)
32 # Export these variables for possible use in architecture dependent makefiles.
33 export TARGET_ARCH
34 export TARGET_ARCH_DIR
35 export TARGET_ARCH_FAM
36 export XEN_TARGET_X86_PAE
38 # This is used for architecture specific links.
39 # This can be overwritten from arch specific rules.
40 ARCH_LINKS =
42 # For possible special header directories.
43 # This can be overwritten from arch specific rules.
44 EXTRA_INC =
46 # Include the architecture family's special makerules.
47 # This must be before include minios.mk!
48 include $(TARGET_ARCH_DIR)/arch.mk
50 ifneq ($(LWIPDIR),)
51 lwip=y
52 DEF_CFLAGS += -DHAVE_LWIP
53 DEF_CFLAGS += -I$(LWIPDIR)/src/include
54 DEF_CFLAGS += -I$(LWIPDIR)/src/include/ipv4
55 endif
57 # Include common mini-os makerules.
58 include minios.mk
60 # Set tester flags
61 # CFLAGS += -DBLKTEST_WRITE
63 # Define some default flags for linking.
64 LDLIBS :=
65 LDARCHLIB := -L$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME)
66 LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(TARGET_ARCH).lds
68 # Prefix for global API names. All other symbols are localised before
69 # linking with EXTRA_OBJS.
70 GLOBAL_PREFIX := xenos_
71 EXTRA_OBJS =
73 TARGET := mini-os
75 # Subdirectories common to mini-os
76 SUBDIRS := lib xenbus console
78 # The common mini-os objects to build.
79 OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
80 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
81 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
82 OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
85 .PHONY: default
86 default: $(TARGET)
88 # Create special architecture specific links. The function arch_links
89 # has to be defined in arch.mk (see include above).
90 ifneq ($(ARCH_LINKS),)
91 $(ARCH_LINKS):
92 $(arch_links)
93 endif
95 .PHONY: links
96 links: $(ARCH_LINKS)
97 [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
99 .PHONY: arch_lib
100 arch_lib:
101 $(MAKE) --directory=$(TARGET_ARCH_DIR) || exit 1;
103 ifeq ($(lwip),y)
104 # lwIP library
105 LWC := $(shell find $(LWIPDIR)/ -type f -name '*.c')
106 LWC := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
107 LWC += lwip-arch.c lwip-net.c
108 LWO := $(patsubst %.c,%.o,$(LWC))
110 lwip.a: $(LWO)
111 $(RM) $@
112 $(AR) cqs $@ $^
114 OBJS += lwip.a
116 OBJS := $(filter-out $(LWO), $(OBJS))
117 else
118 OBJS := $(filter-out daytime.o lwip%.o, $(OBJS))
119 endif
121 $(TARGET): links $(OBJS) arch_lib
122 $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJS) $(LDARCHLIB) -o $@.o
123 $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
124 $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
125 gzip -f -9 -c $@ >$@.gz
127 .PHONY: clean arch_clean
129 arch_clean:
130 $(MAKE) --directory=$(TARGET_ARCH_DIR) clean || exit 1;
132 clean: arch_clean
133 for dir in $(SUBDIRS); do \
134 rm -f $$dir/*.o; \
135 done
136 rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
137 find . -type l | xargs rm -f
138 $(RM) lwip.a $(LWO)
139 rm -f tags TAGS
142 define all_sources
143 ( find . -follow -name SCCS -prune -o -name '*.[chS]' -print )
144 endef
146 .PHONY: cscope
147 cscope:
148 $(all_sources) > cscope.files
149 cscope -k -b -q
151 .PHONY: tags
152 tags:
153 $(all_sources) | xargs ctags
155 .PHONY: TAGS
156 TAGS:
157 $(all_sources) | xargs etags