Move main.mk under Mk folder and improve make files

This commit is contained in:
Soner Tari 2020-06-23 13:00:05 +03:00
parent 1a3a2fb9f6
commit fade72ec0d
6 changed files with 40 additions and 28 deletions

View File

@ -34,10 +34,10 @@ SORT?= sort
TR?= tr
WC?= wc
GITDIR:= $(wildcard $(PROJECT_ROOT).git)
VERSION_FILE:= $(wildcard $(PROJECT_ROOT)VERSION)
HASHES_FILE:= $(wildcard $(PROJECT_ROOT)HASHES)
NEWS_FILE:= $(firstword $(wildcard $(PROJECT_ROOT)NEWS*))
GITDIR:= $(wildcard $(PROJECT_ROOT)/.git)
VERSION_FILE:= $(wildcard $(PROJECT_ROOT)/VERSION)
HASHES_FILE:= $(wildcard $(PROJECT_ROOT)/HASHES)
NEWS_FILE:= $(firstword $(wildcard $(PROJECT_ROOT)/NEWS*))
ifdef GITDIR
BUILD_VERSION:= $(shell cd $(PROJECT_ROOT) && $(GIT) describe --tags --dirty --always)

View File

@ -123,8 +123,12 @@ DEBUG_CFLAGS?= -g
#
# Note that you can override the XNU headers used by defining XNU_VERSION.
ifndef PROJECT_ROOT
$(error PROJECT_ROOT not defined)
endif
ifeq ($(shell uname),Darwin)
include $(PROJECT_ROOT)Mk/xcode.mk
include $(PROJECT_ROOT)/Mk/xcode.mk
ifneq ($(wildcard /usr/include/libproc.h),)
FEATURES+= -DHAVE_DARWIN_LIBPROC
endif
@ -139,15 +143,15 @@ XNU_HAVE:= $(XNU_VERSION)
endif
ifeq ($(wildcard xnu/xnu-$(XNU_VERSION)),)
XNU_METHOD= sw_vers
XNU_VERSION= $(shell awk '/^XNU_RELS.*\# $(OSX_VERSION)$$/ {print $$2}' $(PROJECT_ROOT)xnu/GNUmakefile)
XNU_VERSION= $(shell awk '/^XNU_RELS.*\# $(OSX_VERSION)$$/ {print $$2}' $(PROJECT_ROOT)/xnu/GNUmakefile)
endif
ifeq ($(wildcard xnu/xnu-$(XNU_VERSION)),)
XNU_METHOD= fallback
XNU_VERSION= $(shell awk '/^XNU_RELS/ {print $$2}' $(PROJECT_ROOT)xnu/GNUmakefile|tail -1)
XNU_VERSION= $(shell awk '/^XNU_RELS/ {print $$2}' $(PROJECT_ROOT)/xnu/GNUmakefile|tail -1)
endif
ifneq ($(wildcard xnu/xnu-$(XNU_VERSION)),)
FEATURES+= -DHAVE_PF
PKG_CPPFLAGS+= -I$(PROJECT_ROOT)xnu/xnu-$(XNU_VERSION)
PKG_CPPFLAGS+= -I$(PROJECT_ROOT)/xnu/xnu-$(XNU_VERSION)
BUILD_INFO+= OSX:$(OSX_VERSION) XNU:$(XNU_VERSION):$(XNU_METHOD):$(XNU_HAVE)
endif
endif
@ -251,7 +255,7 @@ PKGNAME:= sslproxy
TARGET:= $(PKGNAME)
FEATURES:= $(sort $(FEATURES))
include $(PROJECT_ROOT)Mk/buildinfo.mk
include $(PROJECT_ROOT)/Mk/buildinfo.mk
VERSION:= $(BUILD_VERSION)
ifdef GITDIR
CFLAGS+= $(DEBUG_CFLAGS)

View File

@ -1,10 +1,14 @@
PROJECT_ROOT= ../
include $(PROJECT_ROOT)main.mk
PROJECT_ROOT= ..
include $(PROJECT_ROOT)/Mk/main.mk
ifndef SRCDIR
$(error SRCDIR not defined)
endif
SRCS:= $(wildcard *.c)
HDRS:= $(wildcard *.h)
OBJS:= $(SRCS:.c=.o)
MKFS:= $(wildcard GNUmakefile $(PROJECT_ROOT)GNUmakefile $(PROJECT_ROOT)main.mk $(PROJECT_ROOT)Mk/*.mk)
MKFS:= $(wildcard GNUmakefile $(PROJECT_ROOT)/GNUmakefile $(PROJECT_ROOT)/Mk/*.mk)
all: $(TARGET)

View File

@ -1,14 +1,18 @@
PROJECT_ROOT= ../../
include $(PROJECT_ROOT)main.mk
PROJECT_ROOT= ../..
include $(PROJECT_ROOT)/Mk/main.mk
ifndef SRCDIR
$(error SRCDIR not defined)
endif
SRCS:= $(wildcard *.t.c)
OBJS:= $(SRCS:.t.c=.t.o)
SRCSRCS:= $(wildcard $(PROJECT_ROOT)$(SRCDIR)/*.c)
SRCHDRS:= $(wildcard $(PROJECT_ROOT)$(SRCDIR)/*.h)
SRCSRCS:= $(wildcard $(PROJECT_ROOT)/$(SRCDIR)/*.c)
SRCHDRS:= $(wildcard $(PROJECT_ROOT)/$(SRCDIR)/*.h)
SRCSOBJS:= $(SRCSRCS:.c=.o)
OBJS+= $(filter-out $(PROJECT_ROOT)$(SRCDIR)/main.o,$(SRCSOBJS))
MKFS:= $(wildcard GNUmakefile $(PROJECT_ROOT)$(SRCDIR)/GNUmakefile $(PROJECT_ROOT)GNUmakefile $(PROJECT_ROOT)main.mk $(PROJECT_ROOT)Mk/*.mk)
OBJS+= $(filter-out $(PROJECT_ROOT)/$(SRCDIR)/main.o,$(SRCSOBJS))
MKFS:= $(wildcard GNUmakefile $(PROJECT_ROOT)/$(SRCDIR)/GNUmakefile $(PROJECT_ROOT)/GNUmakefile $(PROJECT_ROOT)/Mk/*.mk)
all: test
@ -25,7 +29,7 @@ endif
buildtest: TCPPFLAGS+=-D"TEST_ZEROUSR=\"$(shell id -u -n root||echo 0)\""
buildtest: TCPPFLAGS+=-D"TEST_ZEROGRP=\"$(shell id -g -n root||echo 0)\""
buildtest: TCPPFLAGS+=-I$(PROJECT_ROOT)$(SRCDIR)
buildtest: TCPPFLAGS+=-I$(PROJECT_ROOT)/$(SRCDIR)
buildtest: $(TARGET).test
$(MAKE) -C engine
$(MAKE) -C pki testreqs

View File

@ -1,4 +1,4 @@
PROJECT_ROOT= ../../
PROJECT_ROOT= ../..
TESTPROXY:= ~/.cargo/bin/testproxy
TESTPROXY_VERSION=$(shell $(TESTPROXY) -V)
@ -15,12 +15,12 @@ buildlp:
$(MAKE) -C lp
# XXX: How to build sslproxy before setting the vars? Otherwise, we depend on the main makefile to have already built it.
test: SSL_PROTOS=$(shell $(PROJECT_ROOT)src/sslproxy -V 2>&1 | grep "SSL/TLS protocol availability")
test: SSL_PROTOS=$(shell $(PROJECT_ROOT)/src/sslproxy -V 2>&1 | grep "SSL/TLS protocol availability")
test: TLS11=$(findstring tls11,$(SSL_PROTOS))
test: TLS13=$(findstring tls13,$(SSL_PROTOS))
test: SSLPROXY_CONF=$(if $(TLS13),sslproxy.conf,sslproxy_no_tls13.conf)
test: SSLPROXY_CONF:=$(if $(TLS11),$(SSLPROXY_CONF),sslproxy_no_tls11.conf)
test: SSLPROXY_COMMAND=$(PROJECT_ROOT)src/sslproxy -f $(SSLPROXY_CONF) -o Debug=no -o Daemon=yes -o User=nobody
test: SSLPROXY_COMMAND=$(PROJECT_ROOT)/src/sslproxy -f $(SSLPROXY_CONF) -o Debug=no -o Daemon=yes -o User=nobody
test: TESTHARNESS=$(if $(TLS13),testharness.json,testharness_no_tls13.json)
test: TESTHARNESS:=$(if $(TLS11),$(TESTHARNESS),testharness_no_tls11.json)
test: buildsslproxy buildlp

View File

@ -43,7 +43,7 @@
# Build a macOS binary for El Capitan using the default SDK from Xcode 7.3.1:
# % MACOSX_VERSION_MIN=10.11 DEVELOPER_DIR=/Applications/Xcode-7.3.1.app/Contents/Developer make
PROJECT_ROOT= ../../../
PROJECT_ROOT= ../../..
VERSION=
### Debugging
@ -80,7 +80,7 @@ DEBUG_CFLAGS?= -g
# Note that you can override the XNU headers used by defining XNU_VERSION.
ifeq ($(shell uname),Darwin)
include $(PROJECT_ROOT)Mk/xcode.mk
include $(PROJECT_ROOT)/Mk/xcode.mk
ifneq ($(wildcard /usr/include/libproc.h),)
FEATURES+= -DHAVE_DARWIN_LIBPROC
endif
@ -95,15 +95,15 @@ XNU_HAVE:= $(XNU_VERSION)
endif
ifeq ($(wildcard xnu/xnu-$(XNU_VERSION)),)
XNU_METHOD= sw_vers
XNU_VERSION= $(shell awk '/^XNU_RELS.*\# $(OSX_VERSION)$$/ {print $$2}' $(PROJECT_ROOT)xnu/GNUmakefile)
XNU_VERSION= $(shell awk '/^XNU_RELS.*\# $(OSX_VERSION)$$/ {print $$2}' $(PROJECT_ROOT)/xnu/GNUmakefile)
endif
ifeq ($(wildcard xnu/xnu-$(XNU_VERSION)),)
XNU_METHOD= fallback
XNU_VERSION= $(shell awk '/^XNU_RELS/ {print $$2}' $(PROJECT_ROOT)xnu/GNUmakefile|tail -1)
XNU_VERSION= $(shell awk '/^XNU_RELS/ {print $$2}' $(PROJECT_ROOT)/xnu/GNUmakefile|tail -1)
endif
ifneq ($(wildcard xnu/xnu-$(XNU_VERSION)),)
FEATURES+= -DHAVE_PF
PKG_CPPFLAGS+= -I$(PROJECT_ROOT)xnu/xnu-$(XNU_VERSION)
PKG_CPPFLAGS+= -I$(PROJECT_ROOT)/xnu/xnu-$(XNU_VERSION)
BUILD_INFO+= OSX:$(OSX_VERSION) XNU:$(XNU_VERSION):$(XNU_METHOD):$(XNU_HAVE)
endif
endif
@ -204,7 +204,7 @@ OBJS:= $(SRCS:.c=.o)
MKFS= $(wildcard GNUmakefile Mk/*.mk)
FEATURES:= $(sort $(FEATURES))
include $(PROJECT_ROOT)Mk/buildinfo.mk
include $(PROJECT_ROOT)/Mk/buildinfo.mk
VERSION:= $(BUILD_VERSION)
ifdef GITDIR
CFLAGS+= $(DEBUG_CFLAGS)