Merge branch 'master' into testing
[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                         LIBOSMOVTY_LIBS=$(TOPDIR)/shared/libosmocore/build-host/src/vty/.libs/libosmovty.a \
12                         LIBOSMOCORE_CFLAGS=-I$(TOPDIR)/shared/libosmocore/include \
13                         LIBOSMOVTY_CFLAGS=-I$(TOPDIR)/shared/libosmocore/include
14
15 all: libosmocore-target nofirmware firmware
16 nofirmware: libosmocore-host layer23 osmocon gsmmap
17
18 libosmocore-host: shared/libosmocore/build-host/src/.libs/libosmocore.la
19
20 shared/libosmocore/build-host:
21         mkdir $@
22
23 shared/libosmocore/configure: shared/libosmocore/configure.in
24         cd shared/libosmocore && autoreconf -i
25
26 shared/libosmocore/build-host/Makefile: shared/libosmocore/configure shared/libosmocore/build-host
27         cd shared/libosmocore/build-host && ../configure $(HOST_CONFARGS)
28
29 shared/libosmocore/build-host/src/.libs/libosmocore.la: shared/libosmocore/build-host/Makefile
30         cd shared/libosmocore/build-host && make
31
32
33 libosmocore-target: shared/libosmocore/build-target/src/.libs/libosmocore.a
34
35 shared/libosmocore/build-target:
36         mkdir $@
37
38 shared/libosmocore/build-target/Makefile: shared/libosmocore/configure shared/libosmocore/build-target
39         cd shared/libosmocore/build-target && ../configure \
40                         --host=arm-elf-linux --disable-vty --enable-panic-infloop \
41                         --disable-shared --disable-talloc --disable-tests \
42                 CC="$(CROSS_TOOL_PREFIX)gcc" CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -nostartfiles -nodefaultlibs"
43
44 shared/libosmocore/build-target/src/.libs/libosmocore.a: shared/libosmocore/build-target/Makefile
45         cd shared/libosmocore/build-target && make
46
47
48 .PHONY: osmocon
49 osmocon: host/osmocon/osmocon
50
51 host/osmocon/configure: host/osmocon/configure.ac
52         cd host/osmocon && autoreconf -i
53
54 host/osmocon/Makefile: host/osmocon/configure
55         cd host/osmocon && $(OSMOCORE_CONFIGURE_ENV) ./configure $(HOST_CONFARGS)
56
57 host/osmocon/osmocon: host/osmocon/Makefile libosmocore-host
58         make -C host/osmocon
59
60
61 .PHONY: gsmmap
62 gsmmap: host/gsmmap/gsmmap
63
64 host/gsmmap/configure: host/gsmmap/configure.ac
65         cd host/gsmmap && autoreconf -i
66
67 host/gsmmap/Makefile: host/gsmmap/configure
68         cd host/gsmmap && $(OSMOCORE_CONFIGURE_ENV) ./configure $(HOST_CONFARGS)
69
70 host/gsmmap/gsmmap: host/gsmmap/Makefile libosmocore-host
71         make -C host/gsmmap
72
73
74 .PHONY: layer23
75 layer23: host/layer23/layer23
76
77 host/layer23/configure: host/layer23/configure.ac
78         cd host/layer23 && autoreconf -i
79
80 host/layer23/Makefile: host/layer23/configure
81         cd host/layer23 && $(OSMOCORE_CONFIGURE_ENV) ./configure $(HOST_CONFARGS)
82
83 host/layer23/layer23: host/layer23/Makefile libosmocore-host
84         make -C host/layer23
85
86
87 .PHONY: firmware
88 firmware: libosmocore-target
89         make -C target/firmware CROSS_COMPILE=$(CROSS_TOOL_PREFIX)
90
91
92 clean:
93         make -C shared/libosmocore/build-host $@
94         make -C shared/libosmocore/build-target $@
95         make -C host/layer23 $@
96         make -C host/osmocon $@
97         make -C target/firmware $@
98
99 distclean:
100         rm -rf shared/libosmocore/build-host
101         rm -rf shared/libosmocore/build-target
102         make -C host/layer23 $@
103         make -C host/osmocon $@
104         make -C target/firmware $@