Split CPPFLAGS and CFLAGS more carefully

This has no change to the build, but makes it easier to try
other build tools that only want CPPFLAGS
This commit is contained in:
Matt Johnston 2022-03-22 16:17:05 +08:00
parent 8d11116dcb
commit f030618543
3 changed files with 11 additions and 9 deletions

View File

@ -20,13 +20,13 @@ LIBTOM_LIBS=@LIBTOM_LIBS@
ifeq (@BUNDLED_LIBTOM@, 1) ifeq (@BUNDLED_LIBTOM@, 1)
LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM) LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM)
LIBTOM_CLEAN=ltc-clean ltm-clean LIBTOM_CLEAN=ltc-clean ltm-clean
CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/ CPPFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM) LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
endif endif
OPTION_HEADERS = default_options_guard.h sysoptions.h OPTION_HEADERS = default_options_guard.h sysoptions.h
ifneq ($(wildcard localoptions.h),) ifneq ($(wildcard localoptions.h),)
CFLAGS+=-DLOCALOPTIONS_H_EXISTS CPPFLAGS+=-DLOCALOPTIONS_H_EXISTS
OPTION_HEADERS += localoptions.h OPTION_HEADERS += localoptions.h
endif endif
@ -107,8 +107,8 @@ AR=@AR@
RANLIB=@RANLIB@ RANLIB=@RANLIB@
STRIP=@STRIP@ STRIP=@STRIP@
INSTALL=@INSTALL@ INSTALL=@INSTALL@
CPPFLAGS=@CPPFLAGS@ CPPFLAGS+=@CPPFLAGS@ -I. -I$(srcdir)
CFLAGS+=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@ CFLAGS+=@CFLAGS@
LIBS+=@LIBS@ LIBS+=@LIBS@
LDFLAGS=@LDFLAGS@ LDFLAGS=@LDFLAGS@
@ -119,15 +119,16 @@ STATIC=@STATIC@
# whether we're building client, server, or both for the common objects. # whether we're building client, server, or both for the common objects.
# evilness so we detect 'dropbear' by itself as a word # evilness so we detect 'dropbear' by itself as a word
ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z)))) ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
CFLAGS+= -DDROPBEAR_SERVER CPPFLAGS+= -DDROPBEAR_SERVER
endif endif
ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z)))) ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
CFLAGS+= -DDROPBEAR_CLIENT CPPFLAGS+= -DDROPBEAR_CLIENT
endif endif
# these are exported so that libtomcrypt's makefile will use them # these are exported so that libtomcrypt's makefile will use them
export CC export CC
export CFLAGS export CFLAGS
export CPPFLAGS
export RANLIB AR STRIP export RANLIB AR STRIP
ifeq ($(STATIC), 1) ifeq ($(STATIC), 1)
@ -142,7 +143,7 @@ endif
# for the scp progress meter. The -D doesn't affect anything else. # for the scp progress meter. The -D doesn't affect anything else.
ifeq ($(SCPPROGRESS), 1) ifeq ($(SCPPROGRESS), 1)
CFLAGS+=-DPROGRESS_METER CPPFLAGS+=-DPROGRESS_METER
endif endif
all: $(TARGETS) all: $(TARGETS)
@ -216,7 +217,7 @@ scp: $(SCPOBJS) $(HEADERS) Makefile
MULTIOBJS= MULTIOBJS=
ifeq ($(MULTI),1) ifeq ($(MULTI),1)
MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs))) MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))
CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI CPPFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
endif endif
dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile

View File

@ -42,7 +42,7 @@ ARFLAGS = r
EXTRALIBS = ../libtommath/libtommath.a EXTRALIBS = ../libtommath/libtommath.a
#Compilation flags #Compilation flags
LTC_CFLAGS = -Isrc/headers/ -I$(srcdir)/src/headers/ -I../ -I$(srcdir)/../ -DLTC_SOURCE -I../libtommath/ -I$(srcdir)/../libtommath/ $(CFLAGS) LTC_CFLAGS = -Isrc/headers/ -I$(srcdir)/src/headers/ -I../ -I$(srcdir)/../ -DLTC_SOURCE -I../libtommath/ -I$(srcdir)/../libtommath/ $(CFLAGS) $(CPPFLAGS)
LTC_LDFLAGS = $(LDFLAGS) $(EXTRALIBS) LTC_LDFLAGS = $(LDFLAGS) $(EXTRALIBS)
VERSION=1.18.1 VERSION=1.18.1

View File

@ -8,6 +8,7 @@ srcdir=@srcdir@
# So that libtommath can include Dropbear headers for options and m_burn() # So that libtommath can include Dropbear headers for options and m_burn()
CFLAGS += -I$(srcdir) -I../libtomcrypt/src/headers/ -I$(srcdir)/../libtomcrypt/src/headers/ -I../ -I$(srcdir)/../ CFLAGS += -I$(srcdir) -I../libtomcrypt/src/headers/ -I$(srcdir)/../libtomcrypt/src/headers/ -I../ -I$(srcdir)/../
CFLAGS += -Wno-deprecated CFLAGS += -Wno-deprecated
CFLAGS += $(CPPFLAGS)
V = 1 V = 1