Merge commit '48e17f895187100ae7331afa2cbb81594557823f'
[osmocom-bb.git] / src / Makefile
1
2 # this is not really used as we don't do 'make install'. You can still specify
3 # it in case you _want_ to manually 'make install' the target libosmocore.
4 CROSS_INST_PREFIX=/usr/local/stow/osmocom-bb/arm-elf
5
6 # this is the prefix of your cross-toolchain programs
7 CROSS_TOOL_PREFIX=arm-elf-
8
9 TOPDIR=$(shell pwd)
10 OSMOCORE_CONFIGURE_ENV= LIBOSMOCORE_LIBS=$(TOPDIR)/shared/libosmocore/build-host/src/.libs/libosmocore.a \
11                         LIBOSMOCORE_CFLAGS=-I$(TOPDIR)/shared/libosmocore/include
12
13 all: libosmocore-host libosmocore-target layer23 osmocon firmware
14
15 libosmocore-host: shared/libosmocore/build-host/src/.libs/libosmocore.la
16
17 shared/libosmocore/build-host:
18         mkdir $@
19
20 shared/libosmocore/configure: shared/libosmocore/configure.in
21         cd shared/libosmocore && autoreconf -i
22
23 shared/libosmocore/build-host/Makefile: shared/libosmocore/configure shared/libosmocore/build-host
24         cd shared/libosmocore/build-host && ../configure
25
26 shared/libosmocore/build-host/src/.libs/libosmocore.la: shared/libosmocore/build-host/Makefile
27         cd shared/libosmocore/build-host && make
28
29
30 libosmocore-target: shared/libosmocore/build-target/src/.libs/libosmocore.a
31
32 shared/libosmocore/build-target:
33         mkdir $@
34
35 shared/libosmocore/build-target/Makefile: shared/libosmocore/configure shared/libosmocore/build-target
36         cd shared/libosmocore/build-target && ../configure --host=arm-elf-linux --disable-shared \
37                 CFLAGS="-Os -ffunction-sections"
38
39 shared/libosmocore/build-target/src/.libs/libosmocore.a: shared/libosmocore/build-target/Makefile
40         cd shared/libosmocore/build-target && make
41
42
43 .PHONY: osmocon
44 osmocon: host/osmocon/osmocon
45
46 host/osmocon/configure: host/osmocon/configure.ac
47         cd host/osmocon && autoreconf -i
48
49 host/osmocon/Makefile: host/osmocon/configure
50         cd host/osmocon && $(OSMOCORE_CONFIGURE_ENV) ./configure
51
52 host/osmocon/osmocon: host/osmocon/Makefile libosmocore-host
53         make -C host/osmocon
54
55
56 .PHONY: layer23
57 layer23: host/layer23/layer23
58
59 host/layer23/configure: host/layer23/configure.ac
60         cd host/layer23 && autoreconf -i
61
62 host/layer23/Makefile: host/layer23/configure
63         cd host/layer23 && $(OSMOCORE_CONFIGURE_ENV) ./configure
64
65 host/layer23/layer23: host/layer23/Makefile libosmocore-host
66         make -C host/layer23
67
68
69 .PHONY: firmware
70 firmware: libosmocore-target
71         make -C target/firmware CROSS_COMPILE=$(CROSS_TOOL_PREFIX)
72
73
74 clean:
75         make -C shared/libosmocore/build-host $@
76         make -C shared/libosmocore/build-target $@
77         make -C host/layer23 $@
78         make -C host/osmocon $@
79         make -C target/firmware $@
80
81 distclean:
82         rm -rf shared/libosmocore/build-host
83         rm -rf shared/libosmocore/build-target
84         make -C host/layer23 $@
85         make -C host/osmocon $@
86         make -C target/firmware $@