commit 5b32047823a7c2e7981d0da356bffce759fab9ce
parent b865c83a9d0c797ce03c688d4cb21693cda1be47
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 23 Jan 2023 22:21:17 +0100
build: Unify sysld and sysincludes
These files can be unified in only one file because at the end
it is only the libc configuration.
Diffstat:
11 files changed, 56 insertions(+), 63 deletions(-)
diff --git a/Makefile b/Makefile
@@ -45,8 +45,7 @@ clean:
rm -rf dirs coverage
distclean: clean
- rm -f include/scc/scc/sysld.h
- rm -f include/scc/scc/sysincludes.h
+ rm -f include/scc/scc/sys.h
include scripts/amd64.mk
include scripts/arm.mk
diff --git a/include/scc/scc/.gitignore b/include/scc/scc/.gitignore
@@ -1,3 +1,2 @@
cstd.h
-sysincludes.h
-sysld.h
+sys.h
diff --git a/include/scc/scc/Makefile b/include/scc/scc/Makefile
@@ -15,18 +15,15 @@ all: cstd.h
cstd.h: cstd-$(STD).h
cp cstd-$(STD).h $@
-config: sysld.h sysincludes.h
+config: sys.h
-sysld.h:
+sys.h: sys-$(LIBPROFILE).h
set -e;\
rm -f $@;\
trap "rm -f $$$$.tmp" INT QUIT TERM HUP;\
sed -e 's/%NOPIE%/"$(NOPIE_LDFLAGS)",/' \
- -e 's/"",//' sysld.$(LIBPROFILE).h > $$$$.tmp && \
+ -e 's/"",//' sys-$(LIBPROFILE).h > $$$$.tmp && \
mv $$$$.tmp $@
-sysincludes.h:
- cp sysincludes.$(LIBPROFILE).h $@
-
clean:
rm -f cstd.h
diff --git a/include/scc/scc/sys-musl.h b/include/scc/scc/sys-musl.h
@@ -0,0 +1,27 @@
+/* configure below your standard sys include paths */
+char *sysincludes[] = {
+ "%p/include/",
+ NULL
+};
+
+/* configure below your system linker command line */
+#define GCCLIBPATH "/usr/lib/gcc/x86_64-unknown-linux-gnu/10.2/"
+
+char *ldcmd[] = {
+ "-static",
+ "-z","nodefaultlib",
+ %NOPIE%
+ "-o","%o",
+ "-L","%p/lib/",
+ "-L",GCCLIBPATH,
+ "%p/lib/Scrt1.o",
+ "%p/lib/crti.o",
+ GCCLIBPATH "crtbeginS.o",
+ "%c",
+ GCCLIBPATH "crtendS.o",
+ "%p/lib/crtn.o",
+ "-lc",
+ "-lgcc",
+ "-lgcc_eh",
+ NULL
+};
diff --git a/include/scc/scc/sys-scc.h b/include/scc/scc/sys-scc.h
@@ -0,0 +1,22 @@
+/* configure below your standard sys include paths */
+char *sysincludes[] = {
+ "%p/include/bits/%a/",
+ "%p/include/bits/%s/",
+ "%p/include/bits/%s/%a/",
+ "%p/include/",
+ NULL
+};
+
+/* configure below your system linker command line */
+char *ldcmd[] = {
+ "-static",
+ "-z","nodefaultlib",
+ %NOPIE%
+ "-o","%o",
+ "-L","%p/lib/scc/%a-%s",
+ "%p/lib/scc/%a-%s/crt.o",
+ "%c",
+ "-lc",
+ "-lcrt",
+ NULL
+};
diff --git a/include/scc/scc/sysincludes.musl.h b/include/scc/scc/sysincludes.musl.h
@@ -1,5 +0,0 @@
-/* configure below your standard sys include paths */
-char *sysincludes[] = {
- "%p/include/",
- NULL
-};
diff --git a/include/scc/scc/sysincludes.scc.h b/include/scc/scc/sysincludes.scc.h
@@ -1,8 +0,0 @@
-/* configure below your standard sys include paths */
-char *sysincludes[] = {
- "%p/include/bits/%a/",
- "%p/include/bits/%s/",
- "%p/include/bits/%s/%a/",
- "%p/include/",
- NULL
-};
diff --git a/include/scc/scc/sysld.musl.h b/include/scc/scc/sysld.musl.h
@@ -1,22 +0,0 @@
-/* configure below your system linker command line */
-
-#define GCCLIBPATH "/usr/lib/gcc/x86_64-unknown-linux-gnu/10.2/"
-
-char *ldcmd[] = {
- "-static",
- "-z","nodefaultlib",
- %NOPIE%
- "-o","%o",
- "-L","%p/lib/",
- "-L",GCCLIBPATH,
- "%p/lib/Scrt1.o",
- "%p/lib/crti.o",
- GCCLIBPATH "crtbeginS.o",
- "%c",
- GCCLIBPATH "crtendS.o",
- "%p/lib/crtn.o",
- "-lc",
- "-lgcc",
- "-lgcc_eh",
- NULL
-};
diff --git a/include/scc/scc/sysld.scc.h b/include/scc/scc/sysld.scc.h
@@ -1,14 +0,0 @@
-/* configure below your system linker command line */
-
-char *ldcmd[] = {
- "-static",
- "-z","nodefaultlib",
- %NOPIE%
- "-o","%o",
- "-L","%p/lib/scc/%a-%s",
- "%p/lib/scc/%a-%s/crt.o",
- "%c",
- "-lc",
- "-lcrt",
- NULL
-};
diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c
@@ -26,8 +26,7 @@
#include "config.h"
#include <scc/arg.h>
#include <scc/scc.h>
-#include <scc/sysincludes.h>
-#include <scc/sysld.h>
+#include <scc/sys.h>
enum {
CC1,
diff --git a/src/cmd/cc/posix/deps.mk b/src/cmd/cc/posix/deps.mk
@@ -1,6 +1,5 @@
#deps
cc.o: $(INCDIR)/scc/scc/arg.h
cc.o: $(INCDIR)/scc/scc/scc.h
-cc.o: $(INCDIR)/scc/scc/sysincludes.h
-cc.o: $(INCDIR)/scc/scc/sysld.h
+cc.o: $(INCDIR)/scc/scc/sys.h
cc.o: config.h