ia64/xen-unstable

view extras/mini-os/Makefile @ 18811:390ef36eb596

Remove Xen-private definitions from kexec public header.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Nov 19 13:13:39 2008 +0000 (2008-11-19)
parents 183d2d7adc2f
children b33b745cd5ec
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 export XEN_ROOT = ../..
8 include $(XEN_ROOT)/Config.mk
9 OBJ_DIR ?= $(CURDIR)
11 ifneq ($(stubdom),y)
12 include Config.mk
13 endif
15 # Include common mini-os makerules.
16 include minios.mk
18 # Set tester flags
19 # CFLAGS += -DBLKTEST_WRITE
21 # Define some default flags for linking.
22 LDLIBS :=
23 APP_LDLIBS :=
24 LDARCHLIB := -L$(OBJ_DIR)/$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME)
25 LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(XEN_TARGET_ARCH).lds
27 # Prefix for global API names. All other symbols are localised before
28 # linking with EXTRA_OBJS.
29 GLOBAL_PREFIX := xenos_
30 EXTRA_OBJS =
32 TARGET := mini-os
34 # Subdirectories common to mini-os
35 SUBDIRS := lib xenbus console
37 # The common mini-os objects to build.
38 APP_OBJS :=
39 OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard *.c))
40 OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard lib/*.c))
41 OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard xenbus/*.c))
42 OBJS += $(patsubst %.c,$(OBJ_DIR)/%.o,$(wildcard console/*.c))
45 .PHONY: default
46 default: $(OBJ_DIR)/$(TARGET)
48 # Create special architecture specific links. The function arch_links
49 # has to be defined in arch.mk (see include above).
50 ifneq ($(ARCH_LINKS),)
51 $(ARCH_LINKS):
52 $(arch_links)
53 endif
55 .PHONY: links
56 links: $(ARCH_LINKS)
57 [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
58 [ -e include/mini-os ] || ln -sf . include/mini-os
59 [ -e include/$(TARGET_ARCH_FAM)/mini-os ] || ln -sf . include/$(TARGET_ARCH_FAM)/mini-os
61 .PHONY: arch_lib
62 arch_lib:
63 $(MAKE) --directory=$(TARGET_ARCH_DIR) OBJ_DIR=$(OBJ_DIR)/$(TARGET_ARCH_DIR) || exit 1;
65 ifeq ($(lwip),y)
66 # lwIP library
67 LWC := $(shell find $(LWIPDIR)/ -type f -name '*.c')
68 LWC := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
69 LWO := $(patsubst %.c,%.o,$(LWC))
70 LWO += $(addprefix $(OBJ_DIR)/,lwip-arch.o lwip-net.o)
72 $(OBJ_DIR)/lwip.a: $(LWO)
73 $(RM) $@
74 $(AR) cqs $@ $^
76 OBJS += $(OBJ_DIR)/lwip.a
77 endif
79 OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
81 ifeq ($(libc),y)
82 APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(XEN_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive
83 APP_LDLIBS += -lpci
84 APP_LDLIBS += -lz
85 APP_LDLIBS += -lm
86 LDLIBS += -lc
87 endif
89 ifneq ($(APP_OBJS)-$(lwip),-y)
90 OBJS := $(filter-out $(OBJ_DIR)/daytime.o, $(OBJS))
91 endif
93 $(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds
94 $(LD) -r -d $(LDFLAGS) -\( $^ -\) $(APP_LDLIBS) --undefined main -o $@
96 $(OBJ_DIR)/$(TARGET): links $(OBJS) $(OBJ_DIR)/$(TARGET)_app.o arch_lib
97 $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJ_DIR)/$(TARGET)_app.o $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o
98 $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
99 $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
100 gzip -f -9 -c $@ >$@.gz
102 .PHONY: clean arch_clean
104 arch_clean:
105 $(MAKE) --directory=$(TARGET_ARCH_DIR) OBJ_DIR=$(OBJ_DIR)/$(TARGET_ARCH_DIR) clean || exit 1;
107 clean: arch_clean
108 for dir in $(addprefix $(OBJ_DIR)/,$(SUBDIRS)); do \
109 rm -f $$dir/*.o; \
110 done
111 rm -f $(OBJ_DIR)/*.o *~ $(OBJ_DIR)/core $(OBJ_DIR)/$(TARGET).elf $(OBJ_DIR)/$(TARGET).raw $(OBJ_DIR)/$(TARGET) $(OBJ_DIR)/$(TARGET).gz
112 find . $(OBJ_DIR) -type l | xargs rm -f
113 $(RM) $(OBJ_DIR)/lwip.a $(LWO)
114 rm -f tags TAGS
117 define all_sources
118 ( find . -follow -name SCCS -prune -o -name '*.[chS]' -print )
119 endef
121 .PHONY: cscope
122 cscope:
123 $(all_sources) > cscope.files
124 cscope -k -b -q
126 .PHONY: tags
127 tags:
128 $(all_sources) | xargs ctags
130 .PHONY: TAGS
131 TAGS:
132 $(all_sources) | xargs etags