1#
2# Makefile for the Baget specific kernel interface routines
3# under Linux.
4#
5# Note! Dependencies are done automagically by 'make dep', which also
6# removes any old dependencies. DON'T put your own dependencies here
7# unless it's something special (ie not a .c file).
8#
9# Note 2! The CFLAGS definitions are now in the main makefile...
10
11all: baget.a
12
13O_TARGET := baget.a
14
15export-objs		:= vacserial.o vacrtc.o
16obj-y			:= baget.o print.o setup.o time.o irq.o bagetIRQ.o \
17			   reset.o
18obj-$(CONFIG_SERIAL)	+= vacserial.o
19obj-$(CONFIG_VAC_RTC)	+= vacrtc.o
20
21bagetIRQ.o : bagetIRQ.S
22	$(CC) $(CFLAGS) -c -o $@ $<
23
24
25##################### Baget Loader stuff ########################
26
27image: ../../../vmlinux
28	cp -f $< $@
29
30image.bin: image
31	$(OBJCOPY) -O binary $< $@
32
33ramdisk.bin:
34	echo "Dummy ramdisk used. Provide your own if needed !" > $@
35
36dummy.c:
37	touch $@
38
39dummy.o: dummy.c image.bin ramdisk.bin
40	$(CC) $(CFLAGS) -c -o $@ $<
41	$(OBJCOPY) --add-section=.vmlinux=image.bin \
42                   --add-section=.ramdisk=ramdisk.bin   $@
43
44balo.h: image
45	$(NM) $< | awk ' \
46	BEGIN               { printf "/* DO NOT EDIT THIS FILE */\n" }    \
47	/_ftext/            { printf "#define LOADADDR 0x%s\n", $$1     } \
48	/kernel_entry/      { printf "#define START 0x%s\n", $$1 }        \
49	/balo_ramdisk_base/ { printf "#define RAMDISK_BASE 0x%s\n", $$1 } \
50	/balo_ramdisk_size/ { printf "#define RAMDISK_SIZE 0x%s\n", $$1 } \
51                       ' > $@
52balo.o:   balo.c balo.h
53	$(CC) $(CFLAGS) -c $<
54
55balo_supp.o: balo_supp.S
56	$(CC) $(CFLAGS) -c $<
57
58balo:   balo.o dummy.o balo_supp.o print.o
59	$(LD) $(LDFLAGS) -T ld.script.balo -o $@ $^
60
61clean:
62	rm -f balo balo.h dummy.c image image.bin
63
64include $(TOPDIR)/Rules.make
65