Makefile 1.11 KB
Newer Older
1
2
3
4
5
#
# build "preprocessed" .h files for inclusion of ARM scratch code
#

SPL_THUNK := fel-to-spl-thunk.h
6
7
THUNKS := clrsetbits.h
THUNKS += memcpy.h
8
9
10
THUNKS += readl_writel.h
THUNKS += rmr-thunk.h
THUNKS += sid_read_root.h
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

all: $(SPL_THUNK) $(THUNKS)
# clean up object files afterwards
	rm -f *.o

# This empty prerequisite enforces a rebuild of all the headers on every run
FORCE:

# If not specified explicitly: try to guess a suitable ARM toolchain prefix
PATH_DIRS := $(shell echo $$PATH | sed -e 's/:/ /g')
CROSS_COMPILE ?= $(shell find $(PATH_DIRS) -executable -name 'arm*-gcc' -printf '%f\t' | cut -f 1 | sed -e 's/-gcc/-/')

AS := $(CROSS_COMPILE)as
OBJDUMP := $(CROSS_COMPILE)objdump

AWK_O_TO_H := awk -f objdump_to_h.awk

# The SPL thunk requires a different output format. The "style" variable for
# awk controls this, and causes the htole32() conversion to be omitted.
fel-to-spl-thunk.h: fel-to-spl-thunk.S FORCE
	$(AS) -o $(subst .S,.o,$<) $<
	$(OBJDUMP) -d $(subst .S,.o,$<) | $(AWK_O_TO_H) -v style=old > $@

$(THUNKS): %.h: %.S FORCE
	$(AS) -o $(subst .S,.o,$<) $<
	$(OBJDUMP) -d $(subst .S,.o,$<) | $(AWK_O_TO_H) > $@