Re: kbuild now support arch/$ARCH/include - time for ARCHs to convert

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Paul Mundt <lethal@...>
Cc: Geert Uytterhoeven <geert@...>, David Howells <dhowells@...>, Greg Ungerer <gerg@...>, Sam Ravnborg <sam@...>, linux arch <linux-arch@...>, LKML <linux-kernel@...>, Linux/m68k <linux-m68k@...>, uClinux list <uclinux-dev@...>
Date: Thursday, July 31, 2008 - 3:47 pm

On Thursday 31 July 2008, Paul Mundt wrote:
 
I've played around with the purely mechanical side of merging the
m68k{,nommu} header files and came up with a script to do it.
All headers that are identical are used from their m68k variant, the
others get an #include magic like x86 has it for 32/64.

This assumes that the kernel ABI is compatible and that user space
can actually use the m68k headers for m68knommu as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
TARGET=arch/m68k/include/asm
SOURCE1=include/asm-m68k
SOURCE2=include/asm-m68knommu
FILES="atomic.h bitops.h bootinfo.h bug.h bugs.h byteorder.h cache.h \
cacheflush.h checksum.h cputime.h current.h delay.h div64.h \
dma-mapping.h dma.h elf.h entry.h fb.h fpu.h hardirq.h hw_irq.h io.h \
irq.h kmap_types.h local.h machdep.h mc146818rtc.h mmu.h mmu_context.h \
module.h page.h page_offset.h param.h pci.h percpu.h pgalloc.h \
pgtable.h processor.h ptrace.h scatterlist.h sections.h segment.h \
setup.h sigcontext.h siginfo.h signal.h string.h system.h \
thread_info.h timex.h tlbflush.h traps.h uaccess.h ucontext.h \
unaligned.h unistd.h"
EXPORTS="byteorder param ptrace sigcontext siginfo signal unistd"

mergefile() {
	BASE=${1%.h}
	mv $SOURCE1/$1 $TARGET/${BASE}_mmu.h
	mv $SOURCE2/$1 $TARGET/${BASE}_nommu.h
cat << EOF > $TARGET/$1
#ifdef __KERNEL__
#ifdef CONFIG_MMU
#include "${BASE}_mmu.h"
#else
#include "${BASE}_nommu.h"
#endif
#else
#include "${BASE}_mmu.h"
#endif
EOF
}

mergefile2() {
	if [ -e ${TARGET}/$1 ] ; then
		rm $SOURCE2/$1
	else
		mv $SOURCE2/$1 ${TARGET}
	fi
}

addexport() {
	echo "unifdef-y += ${1}_mmu.h" >> $TARGET/Kbuild
}

mkdir -p ${TARGET}
# first the incompatible files
for i in $FILES ; do mergefile $i ; done
# move all the remaining m68k files
mv include/asm-m68k/* arch/m68k/include/asm/
# add a few files that are present only on nommu,
# remove the duplicate nommu files.
for i in `ls include/asm-m68knommu/` ; do mergefile2 $i ; done
# make sure the new files get exported where needed.
for i in $EXPORTS ; do addexport $i ; done
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: kbuild now support arch/$ARCH/include - time for ARCHs t..., Geert Uytterhoeven, (Tue Aug 5, 1:16 pm)
Re: kbuild now support arch/$ARCH/include - time for ARCHs t..., Martin Schwidefsky, (Fri Aug 1, 4:35 am)
Re: kbuild now support arch/$ARCH/include - time for ARCHs t..., Geert Uytterhoeven, (Sun Aug 3, 4:16 pm)
Re: kbuild now support arch/$ARCH/include - time for ARCHs t..., Geert Uytterhoeven, (Mon Aug 4, 12:00 pm)
Re: kbuild now support arch/$ARCH/include - time for ARCHs t..., Geert Uytterhoeven, (Wed Jul 30, 8:26 am)
Re: kbuild now support arch/$ARCH/include - time for ARCHs t..., Arnd Bergmann, (Thu Jul 31, 3:47 pm)
Re: kbuild now support arch/$ARCH/include - time for ARCHs t..., Geert Uytterhoeven, (Thu Jul 31, 3:17 am)