Initial import of OsmocomBB into git repository
[osmocom-bb.git] / src / target / firmware / Makefile
1 INCLUDES=-Iinclude/ -I../../../include
2 -include Makefile.inc
3
4 # individual list of object files, they should probably become libraries
5 FLASH_OBJS=flash/cfi_flash.o
6 DISPLAY_OBJS=display/font_r8x8.o display/st7558.o
7 ABB_OBJS=abb/twl3025.o
8 RF_OBJS=rf/trf6151.o
9 BOARD_C123_OBJS=board/common/rffe_compal_dualband.o board/compal_e88/init.o
10 START=board/common/compal_ramload_start.S
11 LDS=board/common/compal_ramload.lds
12
13 # The objects that we want to link with every application
14 OBJS=start.o $(ABB_OBJS) $(RF_OBJS) $(DISPLAY_OBJS) $(FLASH_OBJS) $(BOARD_C123_OBJS)
15
16 # The libraries that we want to link with every application
17 LIBS=calypso/libcalypso.a layer1/liblayer1.a lib/libmini.a comm/libcomm.a
18
19 # The list of applications we ant to build.  Please add your apps here!
20 APPS=hello_world l1test compal_dump compal_dsp_dump layer1
21
22 APP_BINS=$(APPS:=.bin)
23 APP_ELFS=$(APPS:=.elf)
24 APP_OBJS=$(patsubst %,apps/%/main.o, $(APPS))
25 APP_SIZES=$(APP_ELFS:.elf=.size)
26
27 LST=$(OBJS:.o=.lst) $(APP_OBJS:.o=.lst) $(START:.S=.lst)
28
29 all:    $(APP_BINS) $(APP_ELFS) $(APP_SIZES)
30
31 start.o: $(START)
32         $(CROSS_COMPILE)$(CC) $(CFLAGS) -c -o $@ $^
33
34 %.o: %.c
35         $(CROSS_COMPILE)$(CC) $(CFLAGS) -c -o $@ $^
36
37 %.elf: $(OBJS) apps/%/main.o $(LIBS)
38         $(CROSS_COMPILE)$(LD) $(LDFLAGS) -T $(LDS) -Bstatic -Map $@.map  -o $@ --start-group $^ --end-group
39         $(CROSS_COMPILE)$(SIZE) $@
40
41 %.size: %.elf
42         $(CROSS_COMPILE)$(SIZE) -A $^ > $@
43
44 %.bin: %.elf
45         $(CROSS_COMPILE)objcopy --gap-fill=0xff -O binary $^ $@
46
47 # FIXME: we don't do dependencies into the subdirectories, so we always rebuild
48 .PHONY: calypso/libcalypso.a
49 calypso/libcalypso.a:
50         make -C calypso all
51
52 # FIXME: we don't do dependencies into the subdirectories, so we always rebuild
53 .PHONY: layer1/liblayer1.a
54 layer1/liblayer1.a:
55         make -C layer1 all
56
57 lib/libmini.a:
58         make -C lib all
59
60 # FIXME: we don't do dependencies into the subdirectories, so we always rebuild
61 .PHONY: comm/libcomm.a
62 comm/libcomm.a:
63         make -C comm all
64 clean:
65         make -C calypso clean
66         make -C layer1 clean
67         make -C lib clean
68         make -C comm clean
69         rm -f *.map $(OBJS) $(APP_BINS) $(APP_ELFS) $(APP_SIZES) $(LST)