diff options
Diffstat (limited to 'project')
-rw-r--r-- | project/config/cfgdefs.in | 6 | ||||
-rw-r--r-- | project/config/cfgdefs.sh | 23 | ||||
-rw-r--r-- | project/headers.mk | 48 |
3 files changed, 74 insertions, 3 deletions
diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in index 4299d59..a846390 100644 --- a/project/config/cfgdefs.in +++ b/project/config/cfgdefs.in @@ -4,3 +4,9 @@ LIBC_MAJOR = @libc_major@ LIBC_MINOR = @libc_minor@ LIBC_MICRO = @libc_micro@ +# port source directory +PORT_DIR = @port_dir@ + +# syscall.h +syscall-arch: @libc_syscall_arch@ + diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index 20daffc..02e54b1 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -60,13 +60,33 @@ cfgdefs_detect_libc_version() } +cfgdefs_set_libc_options() +{ + if [ -d $mb_project_dir/arch/$mb_arch ]; then + port_dir='$(PROJECT_DIR)' + arch_dir=$mb_project_dir + else + port_dir='$(SOURCE_DIR)' + arch_dir=$mb_source_dir + fi + + if [ -f $arch_dir/arch/$mb_arch/bits/syscall.h.in ]; then + libc_syscall_arch='syscall-gen' + else + libc_syscall_arch='syscall-copy' + fi +} + + cfgdefs_output_custom_defs() { sed \ + -e 's/@port_dir@/'"$port_dir"'/g' \ -e 's/@libc_ver@/'"$libc_ver"'/g' \ -e 's/@libc_major@/'"$libc_major"'/g' \ -e 's/@libc_minor@/'"$libc_minor"'/g' \ -e 's/@libc_micro@/'"$libc_micro"'/g' \ + -e 's/@libc_syscall_arch@/'"$libc_syscall_arch"'/g' \ "$mb_project_dir/project/config/cfgdefs.in" \ | sed -e 's/[ \t]*$//g' \ >> "$mb_pwd/cfgdefs.mk" @@ -79,6 +99,9 @@ cfgdefs_set_arch # libc version info cfgdefs_detect_libc_version +# libc (variant-specific) options +cfgdefs_set_libc_options + # cfgdefs.in --> cfgdefs.mk cfgdefs_output_custom_defs diff --git a/project/headers.mk b/project/headers.mk index 9d50ee3..ea8bea4 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -1,5 +1,47 @@ -API_HEADERS = \ +# alltypes.h, syscall.h +ALLTYPES_H = build/include/bits/alltypes.h +SYSCALL_H = build/include/bits/syscall.h -INTERNAL_HEADERS = \ +ARCH_GEN_H = $(ALLTYPES_H) $(SYSCALL_H) -ALL_HEADERS = $(API_HEADERS) $(INTERNAL_HEADERS) +ALLTYPES_DEPS = \ + $(PORT_DIR)/arch/$(ARCH)/bits/alltypes.h.in \ + $(SOURCE_DIR)/include/alltypes.h.in \ + $(SOURCE_DIR)/tools/mkalltypes.sed + +$(ALLTYPES_H): build/headers.tag $(ALLTYPES_DEPS) + sed -f $(SOURCE_DIR)/tools/mkalltypes.sed \ + $(PORT_DIR)/arch/$(ARCH)/bits/alltypes.h.in \ + $(SOURCE_DIR)/include/alltypes.h.in > $@ + +syscall-copy: $(PORT_DIR)/arch/$(ARCH)/bits/syscall.h build/headers.tag + cp $< $(SYSCALL_H) + +syscall-gen: $(PORT_DIR)/arch/$(ARCH)/bits/syscall.h.in build/headers.tag + cp $< $(SYSCALL_H).tmp + sed -n -e 's/__NR_/SYS_/p' < $< >> $(SYSCALL_H).tmp + mv $(SYSCALL_H).tmp $(SYSCALL_H) + +$(SYSCALL_H): syscall-arch + + + +# build/include +build/headers.tag: + mkdir -p build/include + mkdir -p build/include/bits + touch $@ + +clean-headers: + rm -f $(ARCH_GEN_H) + rm -f $(SYSCALL_H).tmp + rmdir build/include/bits 2>/dev/null || true + rmdir build/include 2>/dev/null || true + rm -f build/headers.tag + +clean: clean-headers + +.PHONY: syscall-arch +.PHONY: syscall-copy +.PHONY: syscall-gen +.PHONY: clean-headers |