source: trunk/packages/xen-3.1/xen-3.1/extras/mini-os/Makefile @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 3.1 KB
Line 
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#
6
7XEN_ROOT = ../..
8include $(XEN_ROOT)/Config.mk
9
10XEN_INTERFACE_VERSION := 0x00030205
11export XEN_INTERFACE_VERSION
12
13# Set TARGET_ARCH
14override TARGET_ARCH := $(XEN_TARGET_ARCH)
15
16# Set mini-os root path, used in mini-os.mk.
17MINI-OS_ROOT=$(PWD)
18export MINI-OS_ROOT
19
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, ...
23ifeq ($(findstring x86_,$(TARGET_ARCH)),x86_)
24TARGET_ARCH_FAM = x86
25else
26TARGET_ARCH_FAM = $(TARGET_ARCH)
27endif
28
29# The architecture family directory below mini-os.
30TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FAM)
31
32# Export these variables for possible use in architecture dependent makefiles.
33export TARGET_ARCH
34export TARGET_ARCH_DIR
35export TARGET_ARCH_FAM
36export XEN_TARGET_X86_PAE 
37
38# This is used for architecture specific links.
39# This can be overwritten from arch specific rules.
40ARCH_LINKS =
41
42# For possible special header directories.
43# This can be overwritten from arch specific rules.
44EXTRA_INC =
45
46# Include the architecture family's special makerules.
47# This must be before include minios.mk!
48include $(TARGET_ARCH_DIR)/arch.mk
49
50# Include common mini-os makerules.
51include minios.mk
52
53# Define some default flags for linking.
54LDLIBS := 
55LDARCHLIB := -L$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME)
56LDFLAGS_FINAL := -N -T $(TARGET_ARCH_DIR)/minios-$(TARGET_ARCH).lds
57
58# Prefix for global API names. All other symbols are localised before
59# linking with EXTRA_OBJS.
60GLOBAL_PREFIX := xenos_
61EXTRA_OBJS =
62
63TARGET := mini-os
64
65# Subdirectories common to mini-os
66SUBDIRS := lib xenbus console
67
68# The common mini-os objects to build.
69OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
70OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
71OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
72OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
73
74
75.PHONY: default
76default: $(TARGET)
77
78# Create special architecture specific links. The function arch_links
79# has to be defined in arch.mk (see include above).
80ifneq ($(ARCH_LINKS),)
81$(ARCH_LINKS):
82        $(arch_links)
83endif
84
85.PHONY: links
86links:  $(ARCH_LINKS)
87        [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
88
89.PHONY: arch_lib
90arch_lib:
91        $(MAKE) --directory=$(TARGET_ARCH_DIR) || exit 1;
92
93$(TARGET): links $(OBJS) arch_lib
94        $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJS) $(LDARCHLIB) -o $@.o
95        $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
96        $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
97        gzip -f -9 -c $@ >$@.gz
98
99.PHONY: clean arch_clean
100
101arch_clean:
102        $(MAKE) --directory=$(TARGET_ARCH_DIR) clean || exit 1;
103
104clean:  arch_clean
105        for dir in $(SUBDIRS); do \
106                rm -f $$dir/*.o; \
107        done
108        rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
109        find . -type l | xargs rm -f
110        rm -f tags TAGS
111
112
113define all_sources
114     ( find . -follow -name SCCS -prune -o -name '*.[chS]' -print )
115endef
116
117.PHONY: cscope
118cscope:
119        $(all_sources) > cscope.files
120        cscope -k -b -q
121   
122.PHONY: tags
123tags:
124        $(all_sources) | xargs ctags
125
Note: See TracBrowser for help on using the repository browser.