[Mirmince-commits] {mirmince} branch master updated. 467b5d4ab05ff1a36948646801e7c66c4a2de28e

tg at freewrt.org tg at freewrt.org
Wed Jan 23 23:18:07 UTC 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main git repository for FreeWRT project mirmince".

The branch, master has been updated
       via  467b5d4ab05ff1a36948646801e7c66c4a2de28e (commit)
       via  600459ee59bed960c1d5d171330a08e41b45f4ff (commit)
       via  0bf9bcb171a82ae1d46a75aa6e4e9e377085c059 (commit)
      from  8f712c541f05400b008cff201137c861aedc9072 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 467b5d4ab05ff1a36948646801e7c66c4a2de28e
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Wed Jan 23 23:17:55 2013 +0000

    use multi-arch coïnstallable header layout
    
    also gets us rid of the pmake prereq+includes phase
    and allows compiling from an uninstalled tree

commit 600459ee59bed960c1d5d171330a08e41b45f4ff
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Wed Jan 23 22:42:09 2013 +0000

    move generation of gcc wrapper into a script of its own

commit 0bf9bcb171a82ae1d46a75aa6e4e9e377085c059
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Wed Jan 23 22:31:33 2013 +0000

    use -isystem for the mirₘᵢₙcⒺ includes

-----------------------------------------------------------------------

Summary of changes:
 Makefile               |   26 ++++++++++++++++-------
 README                 |   13 +++++-------
 do-install             |   54 +++---------------------------------------------
 do-install => gcc-mk   |   38 +++++++++++-----------------------
 gcc-spec               |    4 ++--
 gcc-wrap               |    8 +++----
 include/fcntl.h        |    2 +-
 include/mirmince/asm.h |   18 +++++++++++++---
 include/mirmince/c.h   |   20 ++++++++++++++----
 osdep/linux/fcntl.h    |    2 +-
 10 files changed, 78 insertions(+), 107 deletions(-)
 copy do-install => gcc-mk (71%)

diff --git a/Makefile b/Makefile
index 3e30b15..c3c882b 100644
--- a/Makefile
+++ b/Makefile
@@ -30,9 +30,10 @@ TG_OS?=		mirbsd
 # not settings
 SHELL=		/bin/mksh
 LIBCDIR=	${.CURDIR}
+OBJADIR!=	realpath .
 TG_CC:=		${CC}
-CC:=		${DST:Q}/bin/cc
-_CONF:=		${LIBCDIR}/obj/.conf-${TG_ARCH:Q}-${TG_OS:Q}
+CC:=		${OBJADIR}/cc
+_CONF:=		${LIBCDIR}/obj/.conf-${TG_ARCH:Q}-${TG_OS:Q}-${OBJADIR:S!/!_!g:Q}
 
 .if defined(V) && $V > 0
 CC+=		-v
@@ -50,11 +51,13 @@ clean:
 cleandir: clean
 	rm -f ${DCLEANFILES}
 
-includes install:
-	${SHELL} ${.CURDIR:Q}/do-install $@ ${TG_CC:Q} ${DST:Q} \
+install:
+	${SHELL} ${.CURDIR:Q}/do-install ${TG_CC:Q} ${DST:Q} \
 	    ${TG_ARCH:Q} ${TG_OS:Q} ${TG_CFLAGS:M*:Q}
 
 CPPFLAGS:=	-D_ALL_SOURCE
+CPPFLAGS+=	-I${LIBCDIR:Q}/include
+CPPFLAGS+=	-D__mirmincE_bootstrap -I${LIBCDIR:Q} -I${OBJADIR:Q}
 CFLAGS:=
 AFLAGS:=
 LDFLAGS:=
@@ -70,7 +73,7 @@ LDADD:=
 .include "${LIBCDIR}/osdep/${TG_OS}/Makefile.inc"
 .include "${LIBCDIR}/osdep/${TG_OS}/${TG_ARCH}/Makefile.inc"
 
-.if !make(obj) && !make(prereq) && !make(depend) && !make(clean)
+.if !make(obj) && !make(depend) && !make(clean)
 .include "${LIBCDIR}/obj/Makefile.gen"
 .endif
 
@@ -111,6 +114,16 @@ GENHDRS+=	syscall.h syscallc.h
 ${_CONF}:
 	@:>$@
 
+DCLEANFILES+=	cc cc-spec .cc-done
+
+depend: cc cc-spec
+cc cc-spec: .cc-done
+.cc-done: ${_CONF} gcc-mk gcc-spec gcc-wrap
+	${SHELL} ${.CURDIR:Q}/gcc-mk ${TG_CC:Q} ${DST:Q} \
+	    ${TG_ARCH:Q} ${TG_OS:Q} ${TG_CFLAGS:M*:Q} \
+	    ${OBJADIR:Q} ${OBJADIR:Q} ${OBJADIR:Q}
+	@:>$@
+
 DCLEANFILES+=	syscall.h syscallc.h Makefile.gen
 
 syscall.h syscallc.h Makefile.gen: ${_CONF} cvsyscls ${LIBCDIR}/osdep/${TG_OS}/syscalls
@@ -125,7 +138,7 @@ SOBJS+=		sys_${_n}.o
 
 sys_${_n}.S:
 	x='#include <mirmince/asm.h>'; \
-	x+=$$'\n#include <mirmince/syscall.h>'; \
+	x+=$$'\n#include mirmince_hdr_gen(syscall.h)'; \
 	x+=$$'\nSYSCALL${_a}(${_n}, ${_k})'; \
 	    print -r -- "$$x" >$@
 
@@ -136,7 +149,6 @@ sys_${_n}.o: sys_${_n}.S
 .endfor
 
 depend: ${GENHDRS} Makefile.gen
-prereq: ${GENHDRS} Makefile.gen
 
 all: libminze.a
 
diff --git a/README b/README
index 11bf255..747079c 100644
--- a/README
+++ b/README
@@ -4,19 +4,16 @@ To build:
 
 ① adjust DST, CC, TG_ARCH, TG_OS in BSDmakefile
 ② make obj		# creates ./obj/ (mandatory)
-③ make prereq		# creates some generated files
-④ sudo make includes	# installs them and the headers
-⑤ make depend		# currently, does nothing more…
-⑥ make			# builds mirₘᵢₙcⒺ CSU and CRT
-⑦ sudo make install	# installs everything to $DST
+③ make depend		# creates some generated files
+④ make			# builds mirₘᵢₙcⒺ CSU and CRT
+⑤ sudo make install	# installs everything to $DST
 
 You’ll need MirMake: a BSD make that automatically descends
 into ./obj/ and reads .depend if possible and supports several
 variable expansion manipulation operators like :M :Q :S etc.
 
-On Debian/amd64 install pmake and expose CC='cc -m32' to both
-pmake includes and pmake install and LDEMULATION=elf_i386 to
-all pmake calls.
+On Debian/amd64 install pmake and expose CC='cc -m32' and
+LDEMULATION=elf_i386 to pmake depend and pmake install calls.
 
 To use:
 
diff --git a/do-install b/do-install
index 6e47f1f..20cbd42 100644
--- a/do-install
+++ b/do-install
@@ -20,68 +20,20 @@
 #-
 # For now. This will change later (more flexible, etc).
 
-# Stores and restores the following environment variables, for cross
-# compilation helpers with multi-target toolchains:
-# GNUTARGET LDEMULATION
-
-if [[ $1 = includes ]]; then
-	full=0
-elif [[ $1 = install ]]; then
-	full=1
-else
-	exit 1
-fi
-shift
-
 cc=$1
 dst=$2
 arch=$3
 os=$4
 cflags=$5
 
-#XXX in lieu of a configure script
-for tryflags in -Wbounded -fhonour-copts; do
-	$cc $tryflags -E - <<<'' >/dev/null 2>&1 && cflags+=" $tryflags"
-done
-
-set -A defenv
-for x in GNUTARGET LDEMULATION; do
-	eval y=\$$x
-	[[ -n $y ]] || continue
-	defenv[${#defenv[*]}]=$x=$y
-done
-
 cd "$(dirname "$0")"
 rm -rf "$dst"/{bin,include,lib,libdata}
-mkdir -p "$dst"/{bin,include/mirmince/{md,osdep,osmd},lib,libdata}
+mkdir -p "$dst"/{bin,include,lib,libdata}
 cp LICENCE "$dst"/libdata/
-while IFS= read -r line; do
-	print -r -- "${line//@@DST@@/"${dst at Q}"}"
-done <gcc-spec >"$dst"/libdata/gcc-spec
-while IFS= read -r line; do
-	if [[ $line = @@DEFENV@@ ]]; then
-		if (( ${#defenv[*]} )); then
-			line=export
-			for x in "${defenv[@]}"; do
-				line+=" ${x at Q}"
-			done
-			print -r -- "$line"
-		fi
-		continue
-	fi
-	line=${line//@@CC@@/"${cc at Q}"}
-	line=${line//@@MD@@/"${arch at Q}"}
-	line=${line//@@OS@@/"${os at Q}"}
-	line=${line//@@DEFCFLAGS@@/"${cflags at Q}"}
-	print -r -- "${line//@@DST@@/"${dst at Q}"}"
-done <gcc-wrap >"$dst"/bin/cc
-chmod +x "$dst"/bin/cc
+mksh gcc-mk "$cc" "$dst" "$arch" "$os" "$cflags"
 find include -name \*.h -print0 | pax -rw -0 "$dst"/
-(cd md/"$arch" && pax -rw *.h "$dst"/include/mirmince/md/)
-(cd osdep/"$os" && pax -rw *.h "$dst"/include/mirmince/osdep/)
-(cd osdep/"$os/$arch" && pax -rw *.h "$dst"/include/mirmince/osmd/)
+find md osdep -name \*.h -print0 | pax -rw -0 "$dst"/include/mirmince/
 cp obj/syscall.h obj/syscallc.h "$dst"/include/mirmince/
-(( full )) || exit 0
 for f in obj/mince{beg,end}.o obj/*.a; do
 	[[ -s $f ]] || continue
 	cp "$f" "$dst"/lib/
diff --git a/do-install b/gcc-mk
similarity index 71%
copy from do-install
copy to gcc-mk
index 6e47f1f..e3f9f8b 100644
--- a/do-install
+++ b/gcc-mk
@@ -24,20 +24,18 @@
 # compilation helpers with multi-target toolchains:
 # GNUTARGET LDEMULATION
 
-if [[ $1 = includes ]]; then
-	full=0
-elif [[ $1 = install ]]; then
-	full=1
-else
-	exit 1
-fi
-shift
-
 cc=$1
 dst=$2
 arch=$3
 os=$4
 cflags=$5
+specdir=$6
+wrapdir=$7
+libodir=$8
+
+[[ -n $specdir ]] || specdir=$dst/libdata
+[[ -n $wrapdir ]] || wrapdir=$dst/bin
+[[ -n $libodir ]] || libodir=$dst/lib
 
 #XXX in lieu of a configure script
 for tryflags in -Wbounded -fhonour-copts; do
@@ -52,12 +50,10 @@ for x in GNUTARGET LDEMULATION; do
 done
 
 cd "$(dirname "$0")"
-rm -rf "$dst"/{bin,include,lib,libdata}
-mkdir -p "$dst"/{bin,include/mirmince/{md,osdep,osmd},lib,libdata}
-cp LICENCE "$dst"/libdata/
 while IFS= read -r line; do
+	line=${line//@@LIBDIR@@/"${libodir at Q}"}
 	print -r -- "${line//@@DST@@/"${dst at Q}"}"
-done <gcc-spec >"$dst"/libdata/gcc-spec
+done <gcc-spec >"$specdir"/cc-spec
 while IFS= read -r line; do
 	if [[ $line = @@DEFENV@@ ]]; then
 		if (( ${#defenv[*]} )); then
@@ -73,17 +69,7 @@ while IFS= read -r line; do
 	line=${line//@@MD@@/"${arch at Q}"}
 	line=${line//@@OS@@/"${os at Q}"}
 	line=${line//@@DEFCFLAGS@@/"${cflags at Q}"}
+	line=${line//@@SPECDIR@@/"${specdir at Q}"}
 	print -r -- "${line//@@DST@@/"${dst at Q}"}"
-done <gcc-wrap >"$dst"/bin/cc
-chmod +x "$dst"/bin/cc
-find include -name \*.h -print0 | pax -rw -0 "$dst"/
-(cd md/"$arch" && pax -rw *.h "$dst"/include/mirmince/md/)
-(cd osdep/"$os" && pax -rw *.h "$dst"/include/mirmince/osdep/)
-(cd osdep/"$os/$arch" && pax -rw *.h "$dst"/include/mirmince/osmd/)
-cp obj/syscall.h obj/syscallc.h "$dst"/include/mirmince/
-(( full )) || exit 0
-for f in obj/mince{beg,end}.o obj/*.a; do
-	[[ -s $f ]] || continue
-	cp "$f" "$dst"/lib/
-done
-print "You can now use ${dst at Q}/bin/cc to compile."
+done <gcc-wrap >"$wrapdir"/cc
+chmod +x "$wrapdir"/cc
diff --git a/gcc-spec b/gcc-spec
index 6be71e3..0d31113 100644
--- a/gcc-spec
+++ b/gcc-spec
@@ -8,7 +8,7 @@
 --start-group %L --end-group
 
 *startfile:
-@@DST@@/lib/mincebeg.o
+@@LIBDIR@@/mincebeg.o
 
 *endfile:
 
@@ -26,7 +26,7 @@
 
 
 *link_libgcc:
--L@@DST@@/lib
+-L@@LIBDIR@@
 
 *linker:
 /usr/bin/ld
diff --git a/gcc-wrap b/gcc-wrap
index d96afde..2d505cd 100644
--- a/gcc-wrap
+++ b/gcc-wrap
@@ -49,10 +49,10 @@ else
 	v=0
 fi
 
-set -A cmd -- "${cc_words[@]}" -nostdinc -I"$dst"/include -D__mirmincE__ \
-    -D__mirmincE_arch_@@MD@@ -D__mirmincE_arch__=\"@@MD@@\" \
-    -D__mirmincE_os_@@OS@@ -D__mirmincE_os__=\"@@OS@@\" \
-    $defcflags -specs="$dst"/libdata/gcc-spec "$@"
+set -A cmd -- "${cc_words[@]}" -nostdinc -isystem "$dst"/include \
+    -U@@MD@@ -D__mirmincE_arch_@@MD@@ -D__mirmincE_arch__=@@MD@@ \
+    -U@@OS@@ -D__mirmincE_os_@@OS@@ -D__mirmincE_os__=@@OS@@ \
+    $defcflags -specs=@@SPECDIR@@/cc-spec -D__mirmincE__ "$@"
 
 if (( v )); then
 	print -nu2 +
diff --git a/include/fcntl.h b/include/fcntl.h
index 4b20520..99a5174 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -10,7 +10,7 @@
 #define MIRMINCE_NT_PID_T
 #include <mirmince/types.h>
 
-#include <mirmince/osdep/fcntl.h>
+#include mirmince_hdr_osdep(fcntl.h)
 
 __BEGIN_DECLS
 int open(const char *path, int oflag, ...)
diff --git a/include/mirmince/asm.h b/include/mirmince/asm.h
index 67eb4ef..e93fae8 100644
--- a/include/mirmince/asm.h
+++ b/include/mirmince/asm.h
@@ -1,9 +1,21 @@
 #ifndef MIRMINCE_ASM_H
 #define MIRMINCE_ASM_H
 
-#include <mirmince/md/asm.h>
-#include <mirmince/osdep/asm.h>
-#include <mirmince/osmd/asm.h>
+#ifndef mirmince_hdr_PFX
+#ifdef __mirmincE_bootstrap
+#define mirmince_hdr_PFX
+#else
+#define mirmince_hdr_PFX	mirmince/
+#endif
+#define mirmince_hdr_gen(x)	< mirmince_hdr_PFX x >
+#define mirmince_hdr_md(x)	mirmince_hdr_gen(md/__mirmincE_arch__/x)
+#define mirmince_hdr_osdep(x)	mirmince_hdr_gen(osdep/__mirmincE_os__/x)
+#define mirmince_hdr_osmd(x)	mirmince_hdr_gen(osdep/__mirmincE_os__/__mirmincE_arch__/x)
+#endif
+
+#include mirmince_hdr_md(asm.h)
+#include mirmince_hdr_osdep(asm.h)
+#include mirmince_hdr_osmd(asm.h)
 
 #ifndef MIRMINCE_ASM_USCORES
 #ifdef __ELF__
diff --git a/include/mirmince/c.h b/include/mirmince/c.h
index 77b3342..8f7637b 100644
--- a/include/mirmince/c.h
+++ b/include/mirmince/c.h
@@ -1,9 +1,21 @@
 #ifndef MIRMINCE_C_H
 #define MIRMINCE_C_H
 
-#include <mirmince/md/c.h>
-#include <mirmince/osdep/c.h>
-#include <mirmince/osmd/c.h>
+#ifndef mirmince_hdr_PFX
+#ifdef __mirmincE_bootstrap
+#define mirmince_hdr_PFX
+#else
+#define mirmince_hdr_PFX	mirmince/
+#endif
+#define mirmince_hdr_gen(x)	< mirmince_hdr_PFX x >
+#define mirmince_hdr_md(x)	mirmince_hdr_gen(md/__mirmincE_arch__/x)
+#define mirmince_hdr_osdep(x)	mirmince_hdr_gen(osdep/__mirmincE_os__/x)
+#define mirmince_hdr_osmd(x)	mirmince_hdr_gen(osdep/__mirmincE_os__/__mirmincE_arch__/x)
+#endif
+
+#include mirmince_hdr_md(c.h)
+#include mirmince_hdr_osdep(c.h)
+#include mirmince_hdr_osmd(c.h)
 
 #ifdef __cplusplus
 #define __BEGIN_DECLS		extern "C" {
@@ -37,7 +49,7 @@
 #define mirmince_cc_syscall	mirmince_cc_cdecl
 #endif
 
-#include <mirmince/syscallc.h>
+#include mirmince_hdr_gen(syscallc.h)
 
 #define NULL			((void *)0)
 
diff --git a/osdep/linux/fcntl.h b/osdep/linux/fcntl.h
index 51c8731..093ce4e 100644
--- a/osdep/linux/fcntl.h
+++ b/osdep/linux/fcntl.h
@@ -1,6 +1,6 @@
 #ifndef MIRMINCE_OSDEP_LINUX_FCNTL_H
 #define MIRMINCE_OSDEP_LINUX_FCNTL_H
 
-#include <mirmince/osmd/fcntl.h>
+#include mirmince_hdr_osmd(fcntl.h)
 
 #endif


hooks/post-receive
-- 
Main git repository for FreeWRT project mirmince
(FreeWRT project mirmince repository mirmince)


More information about the Mirmince-commits mailing list