linux/debian/build/scripts/mod/Makefile.real

31 lines
1.1 KiB
Makefile

PROGS = modpost.real-$(TYPE)
top_srcdir = ../..
CFLAGS += -I$(top_srcdir)/include
include $(top_srcdir)/debian/build/Makefile.inc
modpost.real-$(TYPE): file2alias.real-$(TYPE).o modpost.real-$(TYPE).o sumversion.real-$(TYPE).o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
%.real-$(TYPE).o: $(SOURCEDIR)/%.c real-$(TYPE)/devicetable-offsets.h
$(CC) -I real-$(TYPE) $(CFLAGS) -c -o $@ $<
WORD_SIZE := $(subst lsb-,,$(subst msb-,,$(TYPE)))
# XXX This doesn't quite work, because if we cross-build between 64-bit
# architectures they may have different alignment for pointers (aka
# kernel_ulong_t). This particularly affects i2c_device_id and
# platform_device_id.
real-$(TYPE)/devicetable-offsets.s: $(SOURCEDIR)/devicetable-offsets.c
$(CC) $(CFLAGS) -include linux/types.h -Dkernel_ulong_t=__u$(WORD_SIZE) -S -o $@ $<
real-$(TYPE)/devicetable-offsets.h: real-$(TYPE)/devicetable-offsets.s
echo >$@ "#define __DEVICEVTABLE_OFFSETS_H__"
sed -ne "/^->/{s:->#\(.*\):/* \1 */:; \
s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:->::; p;}" $< >>$@