xref: /linux/scripts/mod/Makefile (revision bd70134396622ea50b14e34dae0810879884d553)
11da177e4SLinus Torvaldshostprogs-y	:= modpost mk_elfconfig
21da177e4SLinus Torvaldsalways		:= $(hostprogs-y) empty.o
31da177e4SLinus Torvalds
41da177e4SLinus Torvaldsmodpost-objs	:= modpost.o file2alias.o sumversion.o
51da177e4SLinus Torvalds
66543becfSAndreas Schwabdevicetable-offsets-file := devicetable-offsets.h
76543becfSAndreas Schwab
86543becfSAndreas Schwabdefine sed-y
96543becfSAndreas Schwab	"/^->/{s:->#\(.*\):/* \1 */:; \
106543becfSAndreas Schwab	s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
116543becfSAndreas Schwab	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
126543becfSAndreas Schwab	s:->::; p;}"
136543becfSAndreas Schwabendef
146543becfSAndreas Schwab
156543becfSAndreas Schwabquiet_cmd_offsets = GEN     $@
166543becfSAndreas Schwabdefine cmd_offsets
176543becfSAndreas Schwab	(set -e; \
18f82935ebSGeert Uytterhoeven	 echo "#ifndef __DEVICETABLE_OFFSETS_H__"; \
19f82935ebSGeert Uytterhoeven	 echo "#define __DEVICETABLE_OFFSETS_H__"; \
206543becfSAndreas Schwab	 echo "/*"; \
216543becfSAndreas Schwab	 echo " * DO NOT MODIFY."; \
226543becfSAndreas Schwab	 echo " *"; \
236543becfSAndreas Schwab	 echo " * This file was generated by Kbuild"; \
246543becfSAndreas Schwab	 echo " *"; \
256543becfSAndreas Schwab	 echo " */"; \
266543becfSAndreas Schwab	 echo ""; \
276543becfSAndreas Schwab	 sed -ne $(sed-y) $<; \
286543becfSAndreas Schwab	 echo ""; \
296543becfSAndreas Schwab	 echo "#endif" ) > $@
306543becfSAndreas Schwabendef
316543becfSAndreas Schwab
32*bd701343SJan Beulich$(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s
33*bd701343SJan Beulich	$(call if_changed,offsets)
346543becfSAndreas Schwab
35*bd701343SJan Beulichtargets += $(devicetable-offsets-file) devicetable-offsets.s
3622fc4273SAndreas Schwab
371da177e4SLinus Torvalds# dependencies on generated files need to be listed explicitly
381da177e4SLinus Torvalds
391da177e4SLinus Torvalds$(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h
406543becfSAndreas Schwab$(obj)/file2alias.o: $(obj)/$(devicetable-offsets-file)
411da177e4SLinus Torvalds
421da177e4SLinus Torvaldsquiet_cmd_elfconfig = MKELF   $@
439e1b9b80SAlan Jenkins      cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@
441da177e4SLinus Torvalds
451da177e4SLinus Torvalds$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
461da177e4SLinus Torvalds	$(call if_changed,elfconfig)
471da177e4SLinus Torvalds
481da177e4SLinus Torvaldstargets += elfconfig.h
49