aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2025-03-29 00:47:57 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2025-03-29 00:47:57 +0100
commitea46ef1d21ce3bc6b7584cdf21b7b26d5daf72db (patch)
tree129eb76151d531e14e6deb50ab316ab9d852cfe4
parentd9b56c65a2697e0d7a6c0f15f1977803dc94579b (diff)
downloadgcc-ea46ef1d21ce3bc6b7584cdf21b7b26d5daf72db.zip
gcc-ea46ef1d21ce3bc6b7584cdf21b7b26d5daf72db.tar.gz
gcc-ea46ef1d21ce3bc6b7584cdf21b7b26d5daf72db.tar.bz2
cobol: Fix up cobol/{charmaps,valconv}.cc rules
sed -i is not portable, it is supported by GNU sed and perhaps some BSDs, but not elsewhere. Furthermore, I think it is far better to always use #include "../../libgcobol/something.h" paths rather than something depending on the build directory. And because we require GNU make, we don't have to have two different rules for those, can use just one for both. The l variable in there is just to make it fit into 80 columns. 2025-03-28 Jakub Jelinek <jakub@redhat.com> * Make-lang.in (cobol/charmaps.cc, cobol/valconv.cc): Used sed -e instead of cp and multiple sed -i commands. Always prefix libgcobol header names in #include directives with ../../libgcobol/ rather than something depending on $(LIB_SOURCE).
-rw-r--r--gcc/cobol/Make-lang.in25
1 files changed, 4 insertions, 21 deletions
diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
index ee048b0..990d51a 100644
--- a/gcc/cobol/Make-lang.in
+++ b/gcc/cobol/Make-lang.in
@@ -87,27 +87,10 @@ cobol1_OBJS = \
# Various #includes in the files copied from gcc/libgcobol need to be modified
# so that the .h files can be found.
-cobol/charmaps.cc: $(LIB_SOURCE)/charmaps.cc
- cp $^ $@
- sed -i "s|\"ec[.]h\"|\"$(LIB_SOURCE)/ec.h\"|g" $@
- sed -i "s|\"common-defs[.]h\"|\"$(LIB_SOURCE)/common-defs.h\"|g" $@
- sed -i "s|\"io[.]h\"|\"$(LIB_SOURCE)/io.h\"|g" $@
- sed -i "s|\"gcobolio[.]h\"|\"$(LIB_SOURCE)/gcobolio.h\"|g" $@
- sed -i "s|\"gfileio[.]h\"|\"$(LIB_SOURCE)/gfileio.h\"|g" $@
- sed -i "s|\"charmaps[.]h\"|\"$(LIB_SOURCE)/charmaps.h\"|g" $@
- sed -i "s|\"valconv[.]h\"|\"$(LIB_SOURCE)/valconv.h\"|g" $@
- sed -i "s|\"exceptl[.]h\"|\"$(LIB_SOURCE)/exceptl.h\"|g" $@
-
-cobol/valconv.cc: $(LIB_SOURCE)/valconv.cc
- cp $^ $@
- sed -i "s|\"ec[.]h\"|\"$(LIB_SOURCE)/ec.h\"|g" $@
- sed -i "s|\"common-defs[.]h\"|\"$(LIB_SOURCE)/common-defs.h\"|g" $@
- sed -i "s|\"io[.]h\"|\"$(LIB_SOURCE)/io.h\"|g" $@
- sed -i "s|\"gcobolio[.]h\"|\"$(LIB_SOURCE)/gcobolio.h\"|g" $@
- sed -i "s|\"gfileio[.]h\"|\"$(LIB_SOURCE)/gfileio.h\"|g" $@
- sed -i "s|\"charmaps[.]h\"|\"$(LIB_SOURCE)/charmaps.h\"|g" $@
- sed -i "s|\"valconv[.]h\"|\"$(LIB_SOURCE)/valconv.h\"|g" $@
- sed -i "s|\"exceptl[.]h\"|\"$(LIB_SOURCE)/exceptl.h\"|g" $@
+cobol/charmaps.cc cobol/valconv.cc: cobol/%.cc: $(LIB_SOURCE)/%.cc
+ -l='ec\|common-defs\|io\|gcobolio\|gfileio\|charmaps'; \
+ l=$$l'\|valconv\|exceptl'; \
+ sed -e '/^#include/s,"\('$$l'\)\.h","../../libgcobol/\1.h",' $^ > $@
LIB_SOURCE_H=$(wildcard $(LIB_SOURCE)/*.h)