ia64/xen-unstable

view extras/mini-os/Makefile @ 6726:0c7379b702e5

common/kernel.o contains changeset/compiler info.
Blow away on every build.
author kaf24@firebug.cl.cam.ac.uk
date Fri Sep 09 16:26:20 2005 +0000 (2005-09-09)
parents cdfa7dd00c44
children b2f4823b6ff0 b35215021b32 9af349b055e5 3233e7ecfa9f
line source
1 debug ?= y
3 include $(CURDIR)/../../Config.mk
5 # Set TARGET_ARCH
6 override TARGET_ARCH := $(XEN_TARGET_ARCH)
8 # NB. '-Wcast-qual' is nasty, so I omitted it.
9 CFLAGS := -fno-builtin -Wall -Werror -Iinclude/ -Wredundant-decls -Wno-format
10 CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
12 ifeq ($(TARGET_ARCH),x86_32)
13 CFLAGS += -m32 -march=i686
14 LDFLAGS := -m elf_i386
15 endif
17 ifeq ($(TARGET_ARCH),x86_64)
18 CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
19 CFLAGS += -fno-asynchronous-unwind-tables
20 LDFLAGS := -m elf_x86_64
21 endif
23 ifeq ($(debug),y)
24 CFLAGS += -g
25 else
26 CFLAGS += -O3
27 endif
29 TARGET := mini-os
31 OBJS := $(TARGET_ARCH).o
32 OBJS += $(patsubst %.c,%.o,$(wildcard *.c))
33 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
34 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
36 HDRS := $(wildcard include/*.h)
37 HDRS += $(wildcard include/xen/*.h)
39 default: $(TARGET)
41 links:
42 [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
43 [ -e xenbus/xenstored.h ] || ln -sf ../../../tools/xenstore/xenstored.h xenbus/xenstored.h
45 $(TARGET): links $(OBJS)
46 $(LD) -N -T minios-$(TARGET_ARCH).lds $(OBJS) -o $@.elf
47 gzip -f -9 -c $@.elf >$@.gz
49 clean:
50 find . -type f -name '*.o' | xargs rm -f
51 rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
52 find . -type l | xargs rm -f
54 %.o: %.c $(HDRS) Makefile
55 $(CC) $(CFLAGS) -c $< -o $@
57 %.o: %.S $(HDRS) Makefile
58 $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@