1CFLAGS = -g -O2 -Wall $(CPPFLAGS) 2 3TARGET = $(TOPDIR)/include/asm-ia64/offsets.h 4 5all: 6 7mrproper: clean 8 rm -f $(TARGET) 9 10clean: 11 rm -f print_offsets.s print_offsets offsets.h 12 13fastdep: offsets.h 14 @if ! cmp -s offsets.h ${TARGET}; then \ 15 echo -e "*** Updating ${TARGET}..."; \ 16 cp offsets.h ${TARGET}; \ 17 else \ 18 echo "*** ${TARGET} is up to date"; \ 19 fi 20 21# 22# If we're cross-compiling, we use the cross-compiler to translate 23# print_offsets.c into an assembly file and then awk to translate this 24# file into offsets.h. This avoids having to use a simulator to 25# generate this file. This is based on an idea suggested by Asit 26# Mallick. If we're running natively, we can of course just build 27# print_offsets and run it. --davidm 28# 29 30ifeq ($(CROSS_COMPILE),) 31 32offsets.h: print_offsets 33 ./print_offsets > offsets.h 34 35comma := , 36 37print_offsets: emptyoffsets print_offsets.c FORCE_RECOMPILE 38 $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) print_offsets.c -o $@ 39 40FORCE_RECOMPILE: 41 42else 43 44offsets.h: print_offsets.s 45 $(AWK) -f print_offsets.awk $^ > $@ 46 47print_offsets.s: emptyoffsets print_offsets.c 48 $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -S print_offsets.c -o $@ 49 50endif 51 52# 53# The TARGET offsets.h is included by ptrace.h, which is included by 54# print_offsets.c, so can't compile print_offsets.c to create offsets.h 55# until we already have offsets.h. Break the chicken-and-egg cycle by 56# creating a dummy offsets.h with sufficient define's to bootstrap 57# the first compilation of print_offsets.c. 58# 59 60emptyoffsets: 61 test -f ${TARGET} || echo '#define IA64_TASK_THREAD_OFFSET 0' > ${TARGET} 62 63.PHONY: all modules modules_install 64