2019-12-27 00:44:52 -05:00
|
|
|
# should compile with clang like:
|
|
|
|
# CC=clang CFLAGS=-Weverything make clean all
|
|
|
|
# and gcc like:
|
|
|
|
# CC=gcc make clean all
|
|
|
|
|
|
|
|
CFLAGS += -Wall -Wextra -Werror -std=c89 -pedantic \
|
|
|
|
-Wstrict-prototypes -Wold-style-definition -Wconversion \
|
2019-12-30 02:55:42 -05:00
|
|
|
-Wno-missing-prototypes -Wno-missing-noreturn -Wno-format \
|
2019-12-27 00:44:52 -05:00
|
|
|
-O3
|
2019-12-29 00:47:36 -05:00
|
|
|
|
2020-01-04 02:44:42 -05:00
|
|
|
# for now we want termios used by default unless explicitly disabled
|
|
|
|
ifndef NO_TERMIOS
|
|
|
|
CFLAGS += -D_POSIX_SOURCE
|
|
|
|
endif
|
|
|
|
|
2020-01-03 00:20:05 -05:00
|
|
|
# build or grab from https://curl.haxx.se/windows/
|
|
|
|
ifdef PEGH_OPENSSL_WIN
|
|
|
|
|
|
|
|
ifdef PEGH_LIBSODIUM_WIN
|
|
|
|
# both libsodium and openssl
|
|
|
|
CFLAGS = -DPEGH_LIBSODIUM -DPEGH_OPENSSL -I "${PEGH_LIBSODIUM_WIN}/include/" -I "${PEGH_OPENSSL_WIN}/include/"
|
|
|
|
LDLIBS += "${PEGH_LIBSODIUM_WIN}/lib/libsodium.a" "${PEGH_OPENSSL_WIN}/lib/libcrypto.a" -lws2_32
|
|
|
|
else
|
|
|
|
# only openssl
|
|
|
|
CFLAGS = -DPEGH_OPENSSL -I "${PEGH_OPENSSL_WIN}/include/"
|
|
|
|
LDLIBS += "${PEGH_OPENSSL_WIN}/lib/libcrypto.a" -lws2_32
|
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
|
|
|
# build or grab from https://download.libsodium.org/libsodium/releases/
|
|
|
|
ifdef PEGH_LIBSODIUM_WIN
|
|
|
|
CFLAGS = -DPEGH_LIBSODIUM -I "${PEGH_LIBSODIUM_WIN}/include/"
|
|
|
|
LDLIBS += "${PEGH_LIBSODIUM_WIN}/lib/libsodium.a"
|
|
|
|
else
|
|
|
|
|
2019-12-29 00:47:36 -05:00
|
|
|
ifdef PEGH_OPENSSL
|
2019-12-29 23:59:38 -05:00
|
|
|
|
|
|
|
ifdef PEGH_LIBSODIUM
|
|
|
|
# both libsodium and openssl
|
|
|
|
CFLAGS += -DPEGH_LIBSODIUM -DPEGH_OPENSSL
|
2019-12-30 02:55:42 -05:00
|
|
|
LDLIBS += -lsodium -lcrypto
|
2019-12-29 23:59:38 -05:00
|
|
|
else
|
|
|
|
# only openssl
|
2019-12-29 00:47:36 -05:00
|
|
|
CFLAGS += -DPEGH_OPENSSL
|
2019-12-30 02:55:42 -05:00
|
|
|
LDLIBS += -lcrypto
|
2019-12-29 23:59:38 -05:00
|
|
|
endif
|
|
|
|
|
2019-12-29 00:47:36 -05:00
|
|
|
else
|
|
|
|
ifdef PEGH_LIBSODIUM
|
2019-12-29 23:59:38 -05:00
|
|
|
# only libsodium
|
2019-12-29 00:47:36 -05:00
|
|
|
CFLAGS += -DPEGH_LIBSODIUM
|
2019-12-30 02:55:42 -05:00
|
|
|
LDLIBS += -lsodium
|
2019-12-29 00:47:36 -05:00
|
|
|
else
|
2019-12-29 23:59:38 -05:00
|
|
|
# default of only openssl
|
2019-12-29 00:47:36 -05:00
|
|
|
CFLAGS += -DPEGH_OPENSSL
|
2019-12-30 02:55:42 -05:00
|
|
|
LDLIBS += -lcrypto
|
2019-12-29 00:47:36 -05:00
|
|
|
endif
|
|
|
|
endif
|
2020-01-03 00:20:05 -05:00
|
|
|
endif
|
|
|
|
endif
|
2019-12-27 00:44:52 -05:00
|
|
|
|
|
|
|
all : pegh
|
2019-12-25 09:45:47 -05:00
|
|
|
|
|
|
|
clean :
|
|
|
|
rm -f pegh
|