uml makefiles sanitized
PATCH 1/1 uml makefiles sanitized
UML makefiles sanitized:
* number of generated headers reduced to 2 (from user-offsets.c and kernel-offsets.c resp.). The rest is made constant and simply includes those two.
* mk_... helpers are gone now that we don't need to generate these headers
* arch/um/include2 removed since everything under arch/um/include/sysdep is constant now and symlink can point straight to source tree.
* dependencies seriously simplified.
----
arch/um/Makefile +11 -57
@@ -28,8 +28,6 @@ ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \ $(SYMLINK_HEADERS) $(ARCH_DIR)/include/uml-config.h -GEN_HEADERS += $(ARCH_DIR)/include/task.h $(ARCH_DIR)/include/kern_constants.h - um-modes-$(CONFIG_MODE_TT) += tt um-modes-$(CONFIG_MODE_SKAS) += skas
@@ -45,9 +43,7 @@ ARCH_INCLUDE := -I$(ARCH_DIR)/include ifneq ($(KBUILD_SRC),) -ARCH_INCLUDE += -I$(ARCH_DIR)/include2 ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include -MRPROPER_DIRS += $(ARCH_DIR)/include2 endif SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
@@ -87,10 +83,6 @@ SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000) -ifeq ($(CONFIG_MODE_SKAS), y) -$(SYS_HEADERS) : $(ARCH_DIR)/include/skas_ptregs.h -endif - .PHONY: linux all: linux
@@ -111,7 +103,8 @@ $(shell cd $(ARCH_DIR) && ln -sf Kconfig.$(SUBARCH) Kconfig.arch) endif -archprepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) +archprepare: $(ARCH_SYMLINKS) $(ARCH_DIR)/include/user_constants.h +prepare: $(ARCH_DIR)/include/kern_constants.h LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
@@ -146,15 +139,13 @@ #When cleaning we don't include .config, so we don't include #TT or skas makefiles and don't clean skas_ptregs.h. CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ - $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h \ - $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/Kconfig.arch + $(ARCH_DIR)/include/user_constants.h \ + $(ARCH_DIR)/include/kern_constants.h $(ARCH_DIR)/Kconfig.arch MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \ $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os archclean: - $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/util - $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/os-$(OS)/util @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ -o -name '*.gcov' \) -type f -print | xargs rm -f
@@ -180,9 +171,7 @@ @echo ' SYMLINK $@' ifneq ($(KBUILD_SRC),) $(Q)mkdir -p $(ARCH_DIR)/include - $(Q)mkdir -p $(ARCH_DIR)/include2 - $(Q)ln -fsn sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep - $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include2/sysdep + $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep else $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep endif
@@ -202,8 +191,6 @@ define filechk_gen-asm-offsets (set -e; \ - echo "#ifndef __ASM_OFFSETS_H__"; \ - echo "#define __ASM_OFFSETS_H__"; \ echo "/*"; \ echo " * DO NOT MODIFY."; \ echo " *"; \
@@ -212,8 +199,7 @@ echo " */"; \ echo ""; \ sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \ - echo ""; \ - echo "#endif" ) + echo ""; ) endef $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
@@ -222,50 +208,18 @@ $(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c $(CC) $(USER_CFLAGS) -S -o $@ $< -$(ARCH_DIR)/user-offsets.h: $(ARCH_DIR)/user-offsets.s +$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s $(call filechk,gen-asm-offsets) -CLEAN_FILES += $(ARCH_DIR)/user-offsets.s $(ARCH_DIR)/user-offsets.h +CLEAN_FILES += $(ARCH_DIR)/user-offsets.s $(ARCH_DIR)/kernel-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/kernel-offsets.c \ - $(ARCH_SYMLINKS) \ - $(SYS_DIR)/sc.h \ - include/asm include/linux/version.h \ - include/config/MARKER \ - $(ARCH_DIR)/include/user_constants.h + archprepare $(CC) $(CFLAGS) $(NOSTDINC_FLAGS) $(CPPFLAGS) -S -o $@ $< -$(ARCH_DIR)/kernel-offsets.h: $(ARCH_DIR)/kernel-offsets.s +$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/kernel-offsets.s $(call filechk,gen-asm-offsets) -CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s $(ARCH_DIR)/kernel-offsets.h - -$(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task - $(call filechk,gen_header) - -$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/os-$(OS)/util/mk_user_constants - $(call filechk,gen_header) - -$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants - $(call filechk,gen_header) - -$(ARCH_DIR)/include/skas_ptregs.h: $(ARCH_DIR)/kernel/skas/util/mk_ptregs - $(call filechk,gen_header) - -$(ARCH_DIR)/os-$(OS)/util/mk_user_constants: $(ARCH_DIR)/os-$(OS)/util FORCE ; - -$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants: $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/util \ - FORCE ; - -$(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ; - -$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h $(ARCH_DIR)/kernel-offsets.h FORCE - $(Q)$(MAKE) $(build)=$@ - -$(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE - $(Q)$(MAKE) $(build)=$@ - -$(ARCH_DIR)/os-$(OS)/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE - $(Q)$(MAKE) $(build)=$@ +CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s export SUBARCH USER_CFLAGS OS
arch/um/Makefile-i386 +0 -22
@@ -32,25 +32,3 @@ ifneq ($(CONFIG_GPROF),y) ARCH_CFLAGS += -DUM_FASTCALL endif - -SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util -SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h - -prepare: $(SYS_HEADERS) - -$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc - $(call filechk,gen_header) - -$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread - $(call filechk,gen_header) - -$(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE - $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ - -$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_DIR)/kernel-offsets.h FORCE - $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ - -$(SYS_UTIL_DIR): scripts_basic include/asm FORCE - $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) - -CLEAN_FILES += $(SYS_HEADERS)
arch/um/Makefile-skas +0 -2
@@ -10,5 +10,3 @@ CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT) LINK-$(CONFIG_GCOV) += $(GCOV_OPT) LINK-$(CONFIG_GPROF) += $(GPROF_OPT) - -GEN_HEADERS += $(ARCH_DIR)/include/skas_ptregs.h
arch/um/Makefile-x86_64 +0 -21
@@ -12,24 +12,3 @@ ELF_ARCH := i386:x86-64 ELF_FORMAT := elf64-x86-64 - -SYS_UTIL_DIR := $(ARCH_DIR)/sys-x86_64/util -SYS_DIR := $(ARCH_DIR)/include/sysdep-x86_64 - -SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h - -prepare: $(SYS_HEADERS) - -$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc - $(call filechk,gen_header) - -$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread - $(call filechk,gen_header) - -$(SYS_UTIL_DIR)/mk_sc: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE - $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ - -$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(GEN_HEADERS) $(ARCH_DIR)/kernel-offsets.h FORCE - $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ - -CLEAN_FILES += $(SYS_HEADERS)
arch/um/include/common-offsets.h +2 -2
@@ -1,7 +1,7 @@/* for use by sys-$SUBARCH/kernel-offsets.c */ -OFFSET (TASK_REGS , task_struct, thread.regs); -OFFSET (TASK_PID , task_struct, pid); +OFFSET (HOST_TASK_REGS , task_struct, thread.regs); +OFFSET (HOST_TASK_PID , task_struct, pid);DEFINE (UM_KERN_PAGE_SIZE ,PAGE_SIZE );DEFINE (UM_NSEC_PER_SEC ,NSEC_PER_SEC );DEFINE_STR (UM_KERN_EMERG ,KERN_EMERG );
arch/um/include/skas_ptregs.h +6 -0
@@ -0,0 +1,6 @@ +#ifndef __SKAS_PT_REGS_ +#define __SKAS_PT_REGS_ + +#include <user_constants.h> + +#endif
arch/um/include/sysdep-i386/sc.h +44 -0
44 lines not on this page · raw message
arch/um/include/sysdep-i386/thread.h +11 -0
@@ -0,0 +1,11 @@ +#ifndef __UM_THREAD_H +#define __UM_THREAD_H + +#include <kern_constants.h> + +#define TASK_DEBUGREGS (task) ((unsigned long *) &(((char *) (task))[HOST_TASK_DEBUGREGS])) +#ifdef CONFIG_MODE_TT +#define TASK_EXTERN_PID (task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID])) +#endif + +#endif
arch/um/include/sysdep-x86_64/sc.h +45 -0
45 lines not on this page · raw message
arch/um/include/sysdep-x86_64/thread.h +10 -0
@@ -0,0 +1,10 @@ +#ifndef __UM_THREAD_H +#define __UM_THREAD_H + +#include <kern_constants.h> + +#ifdef CONFIG_MODE_TT +#define TASK_EXTERN_PID (task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID])) +#endif + +#endif
arch/um/include/task.h +9 -0
@@ -0,0 +1,9 @@ +#ifndef __TASK_H +#define __TASK_H + +#include <kern_constants.h> + +#define TASK_REGS (task) ((union uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS])) +#define TASK_PID (task) *((int *) &(((char *) (task))[HOST_TASK_PID])) + +#endif
arch/um/kernel/skas/Makefile +0 -2
@@ -6,8 +6,6 @@ obj-y := clone.o exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ syscall.o tlb.o trap_user.o uaccess.o -subdir- := util - USER_OBJS := process.o clone.o include arch/um/scripts/Makefile.rules
arch/um/kernel/skas/util/Makefile +0 -5
@@ -1,5 +0,0 @@ -hostprogs-y := mk_ptregs -always := $(hostprogs-y) - -mk_ptregs-objs := mk_ptregs-$(SUBARCH).o -HOSTCFLAGS_mk_ptregs-$(SUBARCH).o := -I$(objtree)/arch/um
arch/um/kernel/skas/util/mk_ptregs-i386.c +0 -49
49 lines not on this page · raw message
arch/um/kernel/skas/util/mk_ptregs-x86_64.c +0 -66
66 lines not on this page · raw message
arch/um/os-Linux/elf_aux.c +1 -1
@@ -12,7 +12,7 @@#include "init.h" #include "elf_user.h" #include "mem_user.h" -#include <kernel-offsets.h> +#include <kern_constants.h> /* Use the one from the kernel - the host may miss it, if having old headers. */ #if UM_ELF_CLASS ==UM_ELFCLASS32
arch/um/os-Linux/util/Makefile +0 -4
@@ -1,4 +0,0 @@ -hostprogs-y := mk_user_constants -always := $(hostprogs-y) - -HOSTCFLAGS_mk_user_constants.o := -I$(objtree)/arch/um
arch/um/os-Linux/util/mk_user_constants.c +0 -23
@@ -1,23 +0,0 @@ -#include <stdio.h> -#include <user-offsets.h> - -int main (int argc,char **argv) -{ -printf ("/*\n" ); -printf (" * Generated by mk_user_constants\n" ); -printf (" */\n" ); -printf ("\n" ); -printf ("#ifndef __UM_USER_CONSTANTS_H\n" ); -printf ("#define __UM_USER_CONSTANTS_H\n" ); -printf ("\n" ); -/* I'd like to use FRAME_SIZE from ptrace.h here, but that's wrong on -* x86_64 (216 vs 168 bytes). user_regs_struct is the correct size on -* both x86_64 and i386. -*/ -printf ("#define UM_FRAME_SIZE %d\n" , __UM_FRAME_SIZE); - -printf ("\n" ); -printf ("#endif\n" ); - -return (0 ); -}
arch/um/sys-i386/Makefile +0 -2
@@ -18,6 +18,4 @@ $(obj)/stub_segv.o : _c_flags = $(call unprofile,$(CFLAGS)) -subdir- := util - include arch/um/scripts/Makefile.unmap
arch/um/sys-i386/kernel-offsets.c +2 -2
@@ -18,9 +18,9 @@void foo (void ) { -OFFSET (TASK_DEBUGREGS , task_struct, thread.arch.debugregs); +OFFSET (HOST_TASK_DEBUGREGS , task_struct, thread.arch.debugregs);#ifdef CONFIG_MODE_TT -OFFSET (TASK_EXTERN_PID , task_struct, thread.mode.tt.extern_pid); +OFFSET (HOST_TASK_EXTERN_PID , task_struct, thread.mode.tt.extern_pid);#endif #include <common-offsets.h> }
arch/um/sys-i386/user-offsets.c +37 -36
89 lines not on this page · raw message
arch/um/sys-i386/util/Makefile +0 -5
@@ -1,5 +0,0 @@ -hostprogs-y := mk_sc mk_thread -always := $(hostprogs-y) - -HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um -HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um
arch/um/sys-i386/util/mk_sc.c +0 -51
51 lines not on this page · raw message
arch/um/sys-i386/util/mk_thread.c +0 -22
@@ -1,22 +0,0 @@ -#include <stdio.h> -#include <kernel-offsets.h> - -int main (int argc,char **argv) -{ -printf ("/*\n" ); -printf (" * Generated by mk_thread\n" ); -printf (" */\n" ); -printf ("\n" ); -printf ("#ifndef __UM_THREAD_H\n" ); -printf ("#define __UM_THREAD_H\n" ); -printf ("\n" ); -printf ("#define TASK_DEBUGREGS(task) ((unsigned long *) " -"&(((char *) (task))[%d]))\n" ,TASK_DEBUGREGS ); -#ifdef TASK_EXTERN_PID -printf ("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n" , -TASK_EXTERN_PID ); -#endif -printf ("\n" ); -printf ("#endif\n" ); -return (0 ); -}
arch/um/sys-x86_64/Makefile +0 -2
@@ -29,6 +29,4 @@ $(obj)/stub_segv.o: _c_flags = $(call unprofile,$(CFLAGS)) -subdir- := util - include arch/um/scripts/Makefile.unmap
arch/um/sys-x86_64/kernel-offsets.c +1 -1
@@ -19,7 +19,7 @@void foo (void ) {#ifdef CONFIG_MODE_TT -OFFSET (TASK_EXTERN_PID , task_struct, thread.mode.tt.extern_pid); +OFFSET (HOST_TASK_EXTERN_PID , task_struct, thread.mode.tt.extern_pid);#endif #include <common-offsets.h> }
arch/um/sys-x86_64/user-offsets.c +61 -56
132 lines not on this page · raw message
arch/um/sys-x86_64/util/Makefile +0 -8
@@ -1,8 +0,0 @@ -# Copyright 2003 - 2004 Pathscale, Inc -# Released under the GPL - -hostprogs-y := mk_sc mk_thread -always := $(hostprogs-y) - -HOSTCFLAGS_mk_sc.o := -I$(objtree)/arch/um -HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um
arch/um/sys-x86_64/util/mk_sc.c +0 -47
47 lines not on this page · raw message
arch/um/sys-x86_64/util/mk_thread.c +0 -20
@@ -1,20 +0,0 @@ -#include <stdio.h> -#include <kernel-offsets.h> - -int main (int argc,char **argv) -{ -printf ("/*\n" ); -printf (" * Generated by mk_thread\n" ); -printf (" */\n" ); -printf ("\n" ); -printf ("#ifndef __UM_THREAD_H\n" ); -printf ("#define __UM_THREAD_H\n" ); -printf ("\n" ); -#ifdef TASK_EXTERN_PID -printf ("#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[%d]))\n" , -TASK_EXTERN_PID ); -#endif -printf ("\n" ); -printf ("#endif\n" ); -return (0 ); -}
arch/um/util/Makefile +0 -5
@@ -1,5 +0,0 @@ -hostprogs-y := mk_task mk_constants -always := $(hostprogs-y) - -HOSTCFLAGS_mk_task.o := -I$(objtree)/arch/um -HOSTCFLAGS_mk_constants.o := -I$(objtree)/arch/um
arch/um/util/mk_constants.c +0 -32
@@ -1,32 +0,0 @@ -#include <stdio.h> -#include <kernel-offsets.h> - -#define SHOW_INT (sym) printf("#define %s %d\n", #sym, sym) -#define SHOW_STR (sym) printf("#define %s %s\n", #sym, sym) - -int main (int argc,char **argv) -{ -printf ("/*\n" ); -printf (" * Generated by mk_constants\n" ); -printf (" */\n" ); -printf ("\n" ); -printf ("#ifndef __UM_CONSTANTS_H\n" ); -printf ("#define __UM_CONSTANTS_H\n" ); -printf ("\n" ); - -SHOW_INT (UM_KERN_PAGE_SIZE ); - -SHOW_STR (UM_KERN_EMERG ); -SHOW_STR (UM_KERN_ALERT ); -SHOW_STR (UM_KERN_CRIT ); -SHOW_STR (UM_KERN_ERR ); -SHOW_STR (UM_KERN_WARNING ); -SHOW_STR (UM_KERN_NOTICE ); -SHOW_STR (UM_KERN_INFO ); -SHOW_STR (UM_KERN_DEBUG ); - -SHOW_INT (UM_NSEC_PER_SEC ); -printf ("\n" ); -printf ("#endif\n" ); -return (0 ); -}
arch/um/util/mk_task.c +0 -30
@@ -1,30 +0,0 @@ -#include <stdio.h> -#include <kernel-offsets.h> - -void print_ptr (char *name,char *type,int offset) -{ -printf ("#define %s(task) ((%s *) &(((char *) (task))[%d]))\n" , name, type, - offset); -} - -void char *name,char *type,int offset) -{ -printf ("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n" , name, type, - offset); -} - -int main (int argc,char **argv) -{ -printf ("/*\n" ); -printf (" * Generated by mk_task\n" ); -printf (" */\n" ); -printf ("\n" ); -printf ("#ifndef __TASK_H\n" ); -printf ("#define __TASK_H\n" ); -printf ("\n" ); -print_ptr ("TASK_REGS" ,"union uml_pt_regs" ,TASK_REGS ); -"TASK_PID" ,"int" ,TASK_PID ); -printf ("\n" ); -printf ("#endif\n" ); -return (0 ); -}