use autoconf' macros for this

This commit is contained in:
cathugger
2019-03-31 23:25:01 +03:00
parent ff238e224d
commit 52dfa3a665
2 changed files with 9 additions and 27 deletions

View File

@@ -69,7 +69,7 @@ MAINLIB= -lpthread -lsodium @MAINLIB@
TEST_ED25519LIB= -lsodium TEST_ED25519LIB= -lsodium
ALLTGTS= mkp224o test_base64 test_base32 test_base16 test_ed25519 ALLTGTS= mkp224o test_base64 test_base32 test_base16 test_ed25519
ALLEXE= $(patsubst %,%@EXESFX@,$(ALLTGTS)) ALLEXE= $(patsubst %,%@EXEEXT@,$(ALLTGTS))
.PHONY: default all clean distclean depend .PHONY: default all clean distclean depend
@@ -77,19 +77,19 @@ default: mkp224o
all: $(ALLEXE) all: $(ALLEXE)
mkp224o@EXESFX@: $(MAINOBJ) mkp224o@EXEEXT@: $(MAINOBJ)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ $(MAINLIB) && $(MV) $@.tmp $@ $(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ $(MAINLIB) && $(MV) $@.tmp $@
test_base64@EXESFX@: $(TEST_BASE64OBJ) test_base64@EXEEXT@: $(TEST_BASE64OBJ)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ && $(MV) $@.tmp $@ $(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ && $(MV) $@.tmp $@
test_base32@EXESFX@: $(TEST_BASE32OBJ) test_base32@EXEEXT@: $(TEST_BASE32OBJ)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ && $(MV) $@.tmp $@ $(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ && $(MV) $@.tmp $@
test_base16@EXESFX@: $(TEST_BASE16OBJ) test_base16@EXEEXT@: $(TEST_BASE16OBJ)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ && $(MV) $@.tmp $@ $(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ && $(MV) $@.tmp $@
test_ed25519@EXESFX@: $(TEST_ED25519OBJ) test_ed25519@EXEEXT@: $(TEST_ED25519OBJ)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ $(TEST_ED25519LIB) && $(MV) $@.tmp $@ $(CC) $(LDFLAGS) $(CFLAGS) -o $@.tmp $^ $(TEST_ED25519LIB) && $(MV) $@.tmp $@
clean: clean:

View File

@@ -209,27 +209,16 @@ then
) )
fi fi
WIN=0 CFLAGS="$cstd -Wno-pedantic-ms-format -Werror"
AC_MSG_CHECKING([whether CC compiles for Windows API]) AC_MSG_CHECKING([whether CC supports and needs -Wno-pedantic-ms-format])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef _WIN32 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef _WIN32
#error wants windows #error wants windows
#endif]], [])], #endif]], [])],
[AC_MSG_RESULT([yes])] [AC_MSG_RESULT([yes])]
[WIN=1], [cstd="$cstd -Wno-pedantic-ms-format"],
[AC_MSG_RESULT([no])] [AC_MSG_RESULT([no])]
) )
if test "$WIN" -eq 1
then
CFLAGS="$cstd -Wno-pedantic-ms-format -Werror"
AC_MSG_CHECKING([whether CC supports and needs -Wno-pedantic-ms-format])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[cstd="$cstd -Wno-pedantic-ms-format"],
[AC_MSG_RESULT([no])]
)
fi
if test "x$ed25519impl" = "xdonna" if test "x$ed25519impl" = "xdonna"
then then
CFLAGS="$cstd -Wno-unused-function -Werror" CFLAGS="$cstd -Wno-unused-function -Werror"
@@ -320,12 +309,6 @@ yes|pcre2)
;; ;;
esac esac
EXESFX=''
if test "$WIN" -eq 1
then
EXESFX='.exe'
fi
# recreate dir tree, because otherwise gcc will fuck up # recreate dir tree, because otherwise gcc will fuck up
(cd "$srcdir" && find ed25519 -type d) | xargs mkdir -p (cd "$srcdir" && find ed25519 -type d) | xargs mkdir -p
@@ -335,5 +318,4 @@ AC_SUBST(MYDEFS,["$MYDEFS"])
AC_SUBST(MAINLIB,["$MAINLIB"]) AC_SUBST(MAINLIB,["$MAINLIB"])
AC_SUBST(NOPIE,["$nopie"]) AC_SUBST(NOPIE,["$nopie"])
AC_SUBST(SRCDIR,["$srcdir"]) AC_SUBST(SRCDIR,["$srcdir"])
AC_SUBST(EXESFX,["$EXESFX"])
AC_OUTPUT(Makefile) AC_OUTPUT(Makefile)