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; \ 186543becfSAndreas Schwab echo "#ifndef __DEVICEVTABLE_OFFSETS_H__"; \ 196543becfSAndreas Schwab echo "#define __DEVICEVTABLE_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 326543becfSAndreas Schwab# We use internal kbuild rules to avoid the "is up to date" message from make 336543becfSAndreas Schwabscripts/mod/devicetable-offsets.s: scripts/mod/devicetable-offsets.c FORCE 346543becfSAndreas Schwab $(Q)mkdir -p $(dir $@) 356543becfSAndreas Schwab $(call if_changed_dep,cc_s_c) 366543becfSAndreas Schwab 376543becfSAndreas Schwab$(obj)/$(devicetable-offsets-file): scripts/mod/devicetable-offsets.s 386543becfSAndreas Schwab $(call cmd,offsets) 396543becfSAndreas Schwab 40*22fc4273SAndreas Schwabtargets += $(devicetable-offsets-file) 41*22fc4273SAndreas Schwab 421da177e4SLinus Torvalds# dependencies on generated files need to be listed explicitly 431da177e4SLinus Torvalds 441da177e4SLinus Torvalds$(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h 456543becfSAndreas Schwab$(obj)/file2alias.o: $(obj)/$(devicetable-offsets-file) 461da177e4SLinus Torvalds 471da177e4SLinus Torvaldsquiet_cmd_elfconfig = MKELF $@ 489e1b9b80SAlan Jenkins cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@ 491da177e4SLinus Torvalds 501da177e4SLinus Torvalds$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE 511da177e4SLinus Torvalds $(call if_changed,elfconfig) 521da177e4SLinus Torvalds 531da177e4SLinus Torvaldstargets += elfconfig.h 54