From 637d5e553925c250943585f19fe813f36e89433c Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Mon, 30 Mar 2026 12:32:24 +0300 Subject: [PATCH] Use build variables --- .github/workflows/c-cpp.yml | 7 ++++--- Makefile.FreeBSD | 6 +++--- Makefile.Linux | 12 ++++++------ Makefile.unix | 18 +++++++++--------- Makefile.win | 12 ++++++------ 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 5661aa7..16d1037 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -41,10 +41,11 @@ jobs: - name: ln Windows if: ${{ startsWith(matrix.target, 'windows') }} run: copy Makefile.win Makefile - - name: dirs Windows + - name: make Windows if: ${{ startsWith(matrix.target, 'windows') }} - run: cmd /C 'echo LIBS := -L "c:/program files/openssl/lib/VC/x64/MT" $(LIBS) >>Makefile.win && echo CFLAGS := -I "c:/program files/openssl/include" $(CFLAGS) >>Makefile.win && type Makefile.win && dir "c:/program files/openssl/lib" && set && dir "C:/mingw64/bin" && dir "C:/" && dir "C:/msys64/ucrt64/bin"' - - name: make + run: make all LIBS='-L "c:/program files/openssl/lib/VC/x64/MT"' CFLAGS='-I "c:/program files/openssl/include"' + - name: make POSIX + if: !${{ startsWith(matrix.target, 'windows') }} run: make - name: mkdir if: ${{ startsWith(matrix.target, 'ubuntu') }} diff --git a/Makefile.FreeBSD b/Makefile.FreeBSD index e42714a..fc1ccc1 100644 --- a/Makefile.FreeBSD +++ b/Makefile.FreeBSD @@ -7,14 +7,14 @@ BUILDDIR = ../bin/ CC ?= cc -CFLAGS += -c -fno-strict-aliasing -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL +CFLAGS := -c -fno-strict-aliasing -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL $(CFLAGS) COUT = -o LN ?= ${CC} LDFLAGS += -pthread -fno-strict-aliasing # -lpthreads may be reuiured on some platforms instead of -pthreads # -ldl or -lld may be required for some platforms -DCFLAGS = -fPIC -DLFLAGS = -shared +DCFLAGS ?= -fPIC +DLFLAGS ?= -shared DLSUFFICS = .so LIBS ?= LIBSPREFIX = -l diff --git a/Makefile.Linux b/Makefile.Linux index d831f6a..42f339b 100644 --- a/Makefile.Linux +++ b/Makefile.Linux @@ -8,14 +8,14 @@ # library support. Add -DSAFESQL for poorely written ODBC library / drivers. BUILDDIR = ../bin/ -CC = gcc +CC ?= gcc -CFLAGS = -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER +CFLAGS := -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER $(CFLAGS) COUT = -o -LN = $(CC) -DCFLAGS = -LDFLAGS = -fPIC -O2 -fno-strict-aliasing -pthread -DLFLAGS = -shared +LN ?= ${CC} +DCFLAGS ?= +LDFLAGS ?= -fPIC -O2 -fno-strict-aliasing -pthread +DLFLAGS ?= -shared DLSUFFICS = .ld.so # -lpthreads may be reuqired on some platforms instead of -pthreads LIBSPREFIX = -l diff --git a/Makefile.unix b/Makefile.unix index ef4d671..4db7e11 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -8,21 +8,21 @@ # library support. Add -DSAFESQL for poorely written ODBC library / drivers. BUILDDIR = ../bin/ -CC = gcc +CC ?= gcc # you may need -L/usr/pkg/lib for older NetBSD versions -CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL +CFLAGS := -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL $(CFLAGS) COUT = -o -LN = $(CC) -LDFLAGS = -O2 -fno-strict-aliasing -pthread +LN ?= $(CC) +LDFLAGS ?= -O2 -fno-strict-aliasing -pthread # -lpthreads may be reuqired on some platforms instead of -pthreads # -ldl or -lld may be required for some platforms -DCFLAGS = -fPIC -DLFLAGS = -shared -DLSUFFICS = .ld.so +DCFLAGS ?= -fPIC +DLFLAGS ?= -shared +DLSUFFICS ?= .ld.so LIBS ?= -LIBSPREFIX = -l -LIBSSUFFIX = +LIBSPREFIX ?= -l +LIBSSUFFIX ?= LNOUT = -o EXESUFFICS = OBJSUFFICS = .o diff --git a/Makefile.win b/Makefile.win index f1b111e..ea97c65 100644 --- a/Makefile.win +++ b/Makefile.win @@ -9,14 +9,14 @@ BUILDDIR = ../bin/ -CC = gcc -CFLAGS = -O2 -s -c -mthreads -DWITH_STD_MALLOC -DWITH_WSAPOLL +CC ?= gcc +CFLAGS := -O2 -s -c -mthreads -DWITH_STD_MALLOC -DWITH_WSAPOLL $(CFLAGS) COUT = -o -LN = gcc -LDFLAGS = -O2 -s -mthreads -DLFLAGS = -shared +LN ?= $(CC) +LDFLAGS ?= -O2 -s -mthreads +DLFLAGS ?= -shared DLSUFFICS = .dll -LIBS = -lws2_32 -lodbc32 -ladvapi32 -luser32 -lcrypto -lssl +LIBS := -lws2_32 -lodbc32 -ladvapi32 -luser32 $(LIBS) LIBSPREFIX = -l LIBSSUFFIX = LNOUT = -o