summaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: bb83d354f57dac294c89748d9aad958f9969f8ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# this is not really used as we don't do 'make install'. You can still specify
# it in case you _want_ to manually 'make install' the target libosmocore.
CROSS_INST_PREFIX ?= /usr/local/stow/osmocom-bb/arm-2010.09

# this is the host tuple of your cross-toolchain
CROSS_HOST ?= $(shell which arm-elf-gcc >/dev/null 2>&1 && echo arm-elf || echo arm-none-eabi)

# this is the prefix of your cross-toolchain programs
CROSS_TOOL_PREFIX=$(CROSS_HOST)-

TOPDIR=$(shell pwd)

all: libosmocore-target nofirmware firmware mtk-firmware

nofirmware: layer23 osmocon gsmmap gprsdecode virtphy

libosmocore-target: shared/libosmocore/build-target/src/.libs/libosmocore.a

shared/libosmocore/configure: shared/libosmocore/configure.ac
	cd shared/libosmocore && autoreconf -fi

shared/libosmocore/build-target:
	mkdir $@

shared/libosmocore/build-target/Makefile: shared/libosmocore/configure shared/libosmocore/build-target
	cd shared/libosmocore/build-target && ../configure \
			--host=$(CROSS_HOST) --enable-embedded --disable-shared \
			--disable-tests ac_cv_header_sys_select_h=no \
			--disable-tests ac_cv_header_sys_socket_h=no \
		CFLAGS="-Os -ffunction-sections -I$(TOPDIR)/target/firmware/include -nostartfiles -nodefaultlibs"

shared/libosmocore/build-target/src/.libs/libosmocore.a: shared/libosmocore/build-target/Makefile
	cd shared/libosmocore/build-target && make


.PHONY: osmocon
osmocon: host/osmocon/osmocon

host/osmocon/configure: host/osmocon/configure.ac
	cd host/osmocon && autoreconf -i

host/osmocon/Makefile: host/osmocon/configure
	cd host/osmocon && ./configure $(HOST_CONFARGS)

host/osmocon/osmocon: host/osmocon/Makefile
	make -C host/osmocon

.PHONY: virtphy
virtphy: host/virt_phy/virtphy

host/virt_phy/configure: host/virt_phy/configure.ac
	cd host/virt_phy && autoreconf -i

host/virt_phy/Makefile: host/virt_phy/configure
	cd host/virt_phy && ./configure $(HOST_CONFARGS)

host/virt_phy/virtphy: host/virt_phy/Makefile
	make -C host/virt_phy

.PHONY: gsmmap
gsmmap: host/gsmmap/gsmmap

host/gsmmap/configure: host/gsmmap/configure.ac
	cd host/gsmmap && autoreconf -i

host/gsmmap/Makefile: host/gsmmap/configure
	cd host/gsmmap && ./configure $(HOST_CONFARGS)

host/gsmmap/gsmmap: host/gsmmap/Makefile
	make -C host/gsmmap


.PHONY: layer23
layer23: host/layer23/layer23

host/layer23/configure: host/layer23/configure.ac
	cd host/layer23 && autoreconf -i

host/layer23/Makefile: host/layer23/configure
	cd host/layer23 && ./configure $(HOST_CONFARGS)

host/layer23/layer23: host/layer23/Makefile
	make -C host/layer23

.PHONY: gprsdecode
gprsdecode: host/gprsdecode/gprsdecode

host/gprsdecode/configure: host/gprsdecode/configure.ac
	cd host/gprsdecode && autoreconf -i

host/gprsdecode/Makefile: host/gprsdecode/configure
	cd host/gprsdecode && ./configure $(HOST_CONFARGS)

host/gprsdecode/gprsdecode: host/gprsdecode/Makefile
	make -C host/gprsdecode

.PHONY: firmware
firmware: libosmocore-target
	make -C target/firmware CROSS_COMPILE=$(CROSS_TOOL_PREFIX)

.PHONY: mtk-firmware
mtk-firmware: libosmocore-target
	make -C target/firmware -f Makefile.mtk CROSS_COMPILE=$(CROSS_TOOL_PREFIX)


clean:
	make -C shared/libosmocore/build-target $@
	make -C host/layer23 $@
	make -C host/osmocon $@
	make -C host/gsmmap $@
	make -C host/gprsdecode $@
	make -C host/virt_phy $@
	make -C target/firmware $@
	make -C target/firmware -f Makefile.mtk $@

distclean:
	rm -rf shared/libosmocore/build-target
	make -C host/layer23 $@
	make -C host/osmocon $@
	make -C host/gsmmap $@
	make -C host/gprsdecode $@
	make -C host/virt_phy $@
# 'firmware' also handles 'mtk-firmware'
	make -C target/firmware $@