]> git.codecow.com Git - Monocypher.git/commitdiff
Do not hardcode Makefile variables
authorLoup Vaillant <loup@loup-vaillant.fr>
Thu, 24 Aug 2023 16:25:19 +0000 (18:25 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Thu, 24 Aug 2023 16:25:19 +0000 (18:25 +0200)
Now if those variables exist from the environment, they're automatically taken as default

makefile
tests/gen/makefile
tests/speed/makefile

index 6460b22b84ca459dbb50ebdb3393256a0cedc3ce..46f568cb2682fa91919f7933e3ab5b26905dacdf 100644 (file)
--- a/makefile
+++ b/makefile
 .POSIX:
 .SUFFIXES:
 
-CC=gcc -std=c99
-CFLAGS=-pedantic -Wall -Wextra -O3 -march=native
-DESTDIR=
-PREFIX=usr/local
-LIBDIR=$(PREFIX)/lib
-INCLUDEDIR=$(PREFIX)/include
-PKGCONFIGDIR=$(LIBDIR)/pkgconfig
-MANDIR=$(PREFIX)/share/man/man3
+CC?=gcc -std=c99
+CFLAGS?=-pedantic -Wall -Wextra -O3 -march=native
+DESTDIR?=
+PREFIX?=usr/local
+LIBDIR?=$(PREFIX)/lib
+INCLUDEDIR?=$(PREFIX)/include
+PKGCONFIGDIR?=$(LIBDIR)/pkgconfig
+MANDIR?=$(PREFIX)/share/man/man3
 SONAME=libmonocypher.so.4
 
 .PHONY: all library static-library dynamic-library  \
index 800c6c08d058eb0bb3aa9446c9664f92869992b2..0adc51207b7a0d2c1c3470a5815a8e7a1fae3eb6 100644 (file)
@@ -49,8 +49,8 @@
 # You should have received a copy of the CC0 Public Domain Dedication along
 # with this software.  If not, see
 # <https://creativecommons.org/publicdomain/zero/1.0/>
-CC     = gcc -std=c99
-CFLAGS = -pedantic -Wall -Wextra
+CC     ?= gcc -std=c99
+CFLAGS ?= -pedantic -Wall -Wextra
 
 .PHONY: all clean
 
index 5eecac6f31ebd09167fa067889af705afc711ac7..a0944c9e25833f8d40cfabd48a3aeb22b76f08f6 100644 (file)
@@ -49,8 +49,8 @@
 # with this software.  If not, see
 # <https://creativecommons.org/publicdomain/zero/1.0/>
 
-CC=gcc -std=gnu99
-CFLAGS= -pedantic -Wall -Wextra -O3 -march=native
+CC?=gcc -std=gnu99
+CFLAGS?= -pedantic -Wall -Wextra -O3 -march=native
 
 .PHONY: speed speed-sodium speed-hydrogen speed-tweetnacl speed-c25519 \
         speed-donna \