commit 527601ad4c29e586f0ce307353583c5c09f3c321
parent ab69827490c132558469bd0aebc3427c94edf870
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 10:54:22 +0100
build: Move config.h to scc/scc
This header can be useful for other binaries and it
makes sense to move it to the scc namespace.
Diffstat:
7 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/Makefile b/Makefile
@@ -46,6 +46,7 @@ clean:
distclean: clean
rm -f include/scc/scc/sys.h
+ rm -f include/scc/scc/config.h
include scripts/amd64.mk
include scripts/arm.mk
diff --git a/include/scc/scc/.gitignore b/include/scc/scc/.gitignore
@@ -1,2 +1,3 @@
cstd.h
sys.h
+config.h
diff --git a/include/scc/scc/Makefile b/include/scc/scc/Makefile
@@ -1,5 +1,6 @@
.POSIX:
+PREFIX = /usr/local
PROJECTDIR = ../../..
include $(PROJECTDIR)/scripts/rules.mk
@@ -15,10 +16,19 @@ all: cstd.h
cstd.h: cstd-$(STD).h
cp cstd-$(STD).h $@
-config: sys.h
+config: sys.h config.h
+
+config.h:
+ rm -f $@;\
+ trap "rm -f $$$$.h" EXIT INT QUIT HUP TERM;\
+ (echo '#define PREFIX "$(PREFIX)"';\
+ echo '#define ARCH "$(ARCH)"';\
+ echo '#define SYS "$(SYS)"';\
+ echo '#define ABI "$(ABI)"';\
+ echo '#define LIBPREFIX "$(LIBPREFIX)"';\
+ echo '#define FORMAT "$(FORMAT)"') > $$$$.h && mv $$$$.h $@
sys.h: sys-$(LIBPROFILE).h
- set -e;\
rm -f $@;\
trap "rm -f $$$$.tmp" INT QUIT TERM HUP;\
sed -e 's/%NOPIE%/"$(NOPIE_LDFLAGS)",/' \
diff --git a/src/cmd/cc/posix/.gitignore b/src/cmd/cc/posix/.gitignore
@@ -1 +0,0 @@
-config.h
diff --git a/src/cmd/cc/posix/Makefile b/src/cmd/cc/posix/Makefile
@@ -1,6 +1,5 @@
.POSIX:
-PREFIX = /usr/local
PROJECTDIR = ../../../..
include $(PROJECTDIR)/scripts/rules.mk
@@ -22,19 +21,8 @@ $(BINDIR)/scc: scc.sh
cp scc.sh $@
chmod +x $@
-config.h:
- rm -f $@;\
- trap "rm -f $$$$.h" EXIT INT QUIT HUP TERM;\
- (echo '#define PREFIX "$(PREFIX)"';\
- echo '#define ARCH "$(ARCH)"';\
- echo '#define SYS "$(SYS)"';\
- echo '#define ABI "$(ABI)"';\
- echo '#define LIBPREFIX "$(LIBPREFIX)"';\
- echo '#define FORMAT "$(FORMAT)"') > $$$$.h && mv $$$$.h $@
-
clean:
rm -f scc scpp *.o
rm -f $(TARGETS)
- rm -f config.h
include deps.mk
diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c
@@ -25,8 +25,8 @@
#include <stdlib.h>
#include <string.h>
-#include "config.h"
#include <scc/arg.h>
+#include <scc/config.h>
#include <scc/scc.h>
#include <scc/sys.h>
diff --git a/src/cmd/cc/posix/deps.mk b/src/cmd/cc/posix/deps.mk
@@ -1,5 +1,5 @@
#deps
cc.o: $(INCDIR)/scc/scc/arg.h
+cc.o: $(INCDIR)/scc/scc/config.h
cc.o: $(INCDIR)/scc/scc/scc.h
cc.o: $(INCDIR)/scc/scc/sys.h
-cc.o: config.h