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