xref: /linux/scripts/mod/Makefile (revision c0dd671686b2229e888ede77682ab0633b2a0dd7)
1*c0dd6716SJosh PoimboeufOBJECT_FILES_NON_STANDARD := y
2*c0dd6716SJosh Poimboeuf
31da177e4SLinus Torvaldshostprogs-y	:= modpost mk_elfconfig
41da177e4SLinus Torvaldsalways		:= $(hostprogs-y) empty.o
51da177e4SLinus Torvalds
61da177e4SLinus Torvaldsmodpost-objs	:= modpost.o file2alias.o sumversion.o
71da177e4SLinus Torvalds
86543becfSAndreas Schwabdevicetable-offsets-file := devicetable-offsets.h
96543becfSAndreas Schwab
106543becfSAndreas Schwabdefine sed-y
116543becfSAndreas Schwab	"/^->/{s:->#\(.*\):/* \1 */:; \
126543becfSAndreas Schwab	s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
136543becfSAndreas Schwab	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
146543becfSAndreas Schwab	s:->::; p;}"
156543becfSAndreas Schwabendef
166543becfSAndreas Schwab
176543becfSAndreas Schwabquiet_cmd_offsets = GEN     $@
186543becfSAndreas Schwabdefine cmd_offsets
196543becfSAndreas Schwab	(set -e; \
20f82935ebSGeert Uytterhoeven	 echo "#ifndef __DEVICETABLE_OFFSETS_H__"; \
21f82935ebSGeert Uytterhoeven	 echo "#define __DEVICETABLE_OFFSETS_H__"; \
226543becfSAndreas Schwab	 echo "/*"; \
236543becfSAndreas Schwab	 echo " * DO NOT MODIFY."; \
246543becfSAndreas Schwab	 echo " *"; \
256543becfSAndreas Schwab	 echo " * This file was generated by Kbuild"; \
266543becfSAndreas Schwab	 echo " *"; \
276543becfSAndreas Schwab	 echo " */"; \
286543becfSAndreas Schwab	 echo ""; \
296543becfSAndreas Schwab	 sed -ne $(sed-y) $<; \
306543becfSAndreas Schwab	 echo ""; \
316543becfSAndreas Schwab	 echo "#endif" ) > $@
326543becfSAndreas Schwabendef
336543becfSAndreas Schwab
34bd701343SJan Beulich$(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s
35bd701343SJan Beulich	$(call if_changed,offsets)
366543becfSAndreas Schwab
37bd701343SJan Beulichtargets += $(devicetable-offsets-file) devicetable-offsets.s
3822fc4273SAndreas Schwab
391da177e4SLinus Torvalds# dependencies on generated files need to be listed explicitly
401da177e4SLinus Torvalds
411da177e4SLinus Torvalds$(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h
426543becfSAndreas Schwab$(obj)/file2alias.o: $(obj)/$(devicetable-offsets-file)
431da177e4SLinus Torvalds
441da177e4SLinus Torvaldsquiet_cmd_elfconfig = MKELF   $@
459e1b9b80SAlan Jenkins      cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@
461da177e4SLinus Torvalds
471da177e4SLinus Torvalds$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
481da177e4SLinus Torvalds	$(call if_changed,elfconfig)
491da177e4SLinus Torvalds
501da177e4SLinus Torvaldstargets += elfconfig.h
51