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		:= vacrtc.o
16obj-y			:= baget.o print.o setup.o time.o irq.o bagetIRQ.o \
17			   reset.o
18obj-$(CONFIG_VAC_RTC)	+= vacrtc.o
19
20bagetIRQ.o : bagetIRQ.S
21	$(CC) $(CFLAGS) -c -o $@ $<
22
23
24##################### Baget Loader stuff ########################
25
26image: ../../../vmlinux
27	cp -f $< $@
28
29image.bin: image
30	$(OBJCOPY) -O binary $< $@
31
32ramdisk.bin:
33	echo "Dummy ramdisk used. Provide your own if needed !" > $@
34
35dummy.c:
36	touch $@
37
38dummy.o: dummy.c image.bin ramdisk.bin
39	$(CC) $(CFLAGS) -c -o $@ $<
40	$(OBJCOPY) --add-section=.vmlinux=image.bin \
41                   --add-section=.ramdisk=ramdisk.bin   $@
42
43balo.h: image
44	$(NM) $< | awk ' \
45	BEGIN               { printf "/* DO NOT EDIT THIS FILE */\n" }    \
46	/_ftext/            { printf "#define LOADADDR 0x%s\n", $$1     } \
47	/kernel_entry/      { printf "#define START 0x%s\n", $$1 }        \
48	/balo_ramdisk_base/ { printf "#define RAMDISK_BASE 0x%s\n", $$1 } \
49	/balo_ramdisk_size/ { printf "#define RAMDISK_SIZE 0x%s\n", $$1 } \
50                       ' > $@
51balo.o:   balo.c balo.h
52	$(CC) $(CFLAGS) -c $<
53
54balo_supp.o: balo_supp.S
55	$(CC) $(CFLAGS) -c $<
56
57balo:   balo.o dummy.o balo_supp.o print.o
58	$(LD) $(LDFLAGS) -T ld.script.balo -o $@ $^
59
60clean:
61	rm -f balo balo.h dummy.c image image.bin
62
63include $(TOPDIR)/Rules.make
64