Welcome to little lamb

Code » comain » commit 4d4c224

Change how endianness is reported

author Olivier Brunel
2023-12-22 13:14:09 UTC
committer Olivier Brunel
2024-01-02 10:18:38 UTC
parent 6061b7160a51d50c54322cdb301c26eaba552de3

Change how endianness is reported

Don't put variables in all project's config.h but only generate a .endian
file when skalibs is a dependency, i.e. for limb.
limb will then generate an endian.h header with proper macros.

Probably a better/more generic solution (for all sysdeps?) would be nice;
This will do for now.

common.mk +4 -1
configure +3 -5

diff --git a/common.mk b/common.mk
index bdaae4b..7d2f64d 100644
--- a/common.mk
+++ b/common.mk
@@ -37,6 +37,9 @@ DATA =
 # to be removed upon `make clean`
 CLEAN = $(BLD_STATIC_LIBS) $(BLD_SHARED_LIBS) $(BLD_BINS)
 
+# to be removed upon `make distclean`
+DISTCLEAN = .endian
+
 build: comain
 	$(_DIR) comain/mkbuild
 
@@ -207,7 +210,7 @@ clean:
 	$(_CLEAN) rm -rf build ; rm -f $(CLEAN)
 
 distclean: clean
-	$(_CLEAN) rm -f config.mk src/include/config.h
+	$(_CLEAN) rm -f config.mk src/include/config.h $(DISTCLEAN)
 
 repoclean: distclean
 	$(_CLEAN) rm -f configure common.mk
diff --git a/configure b/configure
index 8195759..2ee4ef9 100755
--- a/configure
+++ b/configure
@@ -1079,11 +1079,6 @@ cat <<EOF
 #define ${cprefix}_SHAREDIR  "$sharedir/$name"
 $CVARS
 
-#define ${cprefix}_LITTLE    1234
-#define ${cprefix}_BIG       4321
-#define ${cprefix}_PDP       3412
-#define ${cprefix}_ENDIAN    ${cprefix}_$ENDIAN
-
 #endif /* ${cprefix}_CONFIG_H */
 EOF
 
@@ -1091,5 +1086,8 @@ exec 1>&5 5>&-
 if ! test -d src/include; then mkdir src/include; fi
 mv -f config.h.tmp src/include/config.h
 
+if test $has_skalibs -eq 1; then
+    echo $ENDIAN > .endian
+fi
 
 echo "done."