Fix some problems with LEX and YACC defaults on Linux

Remove flags_darwin, which are the same as flags_unix now
This commit is contained in:
Thomas Jensen 2023-12-01 21:57:53 +01:00 committed by Thomas Jensen
parent 80880a3ad7
commit b91dfd5dff
4 changed files with 16 additions and 40 deletions

View File

@ -51,8 +51,8 @@ jobs:
build-macos:
runs-on: macos-latest
env:
LEX: /usr/local/opt/flex/bin/flex
YACC: /usr/local/opt/bison/bin/bison
BX_LEX: /usr/local/opt/flex/bin/flex
BX_YACC: /usr/local/opt/bison/bin/bison
steps:
- uses: actions/checkout@v4

View File

@ -23,10 +23,9 @@ DOC_FILES = doc/boxes.1 doc/boxes.el
PKG_NAME = boxes-$(BVERSION)
OUT_DIR = out
# Set some defaults for LEX and YACC but allow env
# variables to override them.
LEX ?= flex
YACC ?= bison
# Set some defaults for BX_LEX and BX_YACC but allow env variables to override them.
BX_LEX ?= flex
BX_YACC ?= bison
PCRE2_VERSION = 10.40
PCRE2_DIR = vendor/pcre2-$(PCRE2_VERSION)
@ -44,37 +43,20 @@ WIN_CMOCKA_DIR = vendor/cmocka-$(WIN_CMOCKA_VERSION)
package win32.package package_common utest win32.utest static
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Detect platform (Apple's linker does not support --wrap)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOXES_PLATFORM := ""
ifeq ($(OS),Windows_NT)
BOXES_PLATFORM := win32
else
UNAME_S := $(shell sh -c 'uname -s 2>/dev/null || echo Unknown')
ifeq ($(UNAME_S),Darwin)
BOXES_PLATFORM := darwin
else
BOXES_PLATFORM := unix
endif
endif
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Build
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
build cov debug: infomsg replaceinfos
$(MAKE) -C src BOXES_PLATFORM=$(BOXES_PLATFORM) LEX=$(LEX) YACC=$(YACC) $@
$(MAKE) -C src BOXES_PLATFORM=unix LEX=$(BX_LEX) YACC=$(BX_YACC) $@
win32: infomsg replaceinfos
$(MAKE) -C src BOXES_PLATFORM=$(BOXES_PLATFORM) C_INCLUDE_PATH=../$(PCRE2_DIR)/src LDFLAGS=-L../$(PCRE2_DIR)/.libs \
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src LDFLAGS=-L../$(PCRE2_DIR)/.libs \
LEX=../$(WIN_FLEX_BISON_DIR)/win_flex.exe YACC=../$(WIN_FLEX_BISON_DIR)/win_bison.exe \
LIBNCURSES_WIN_INCLUDE=$(LIBNCURSES_WIN_INCLUDE) build
win32.debug: infomsg replaceinfos
$(MAKE) -C src BOXES_PLATFORM=$(BOXES_PLATFORM) C_INCLUDE_PATH=../$(PCRE2_DIR)/src LDFLAGS=-L../$(PCRE2_DIR)/.libs \
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src LDFLAGS=-L../$(PCRE2_DIR)/.libs \
LEX=../$(WIN_FLEX_BISON_DIR)/win_flex.exe YACC=../$(WIN_FLEX_BISON_DIR)/win_bison.exe \
LIBNCURSES_WIN_INCLUDE=$(LIBNCURSES_WIN_INCLUDE) debug
@ -146,8 +128,8 @@ $(LIBNCURSES_DIR)/lib/libncurses.a: vendor/libncurses-$(LIBNCURSES_VERSION).tar.
cd $(LIBNCURSES_DIR) ; ./configure --enable-static ; $(MAKE)
static: infomsg replaceinfos $(LIBUNISTRING_DIR)/lib/.libs/libunistring.a $(PCRE2_DIR)/.libs/libpcre2-32.a $(LIBNCURSES_DIR)/lib/libncurses.a
$(MAKE) -C src BOXES_PLATFORM=static LEX=$(LEX) YACC=$(YACC) LIBUNISTRING_DIR=$(LIBUNISTRING_DIR) \
PCRE2_DIR=$(PCRE2_DIR) LIBNCURSES_DIR=$(LIBNCURSES_DIR) LIBNCURSES_WIN_INCLUDE=$(LIBNCURSES_WIN_INCLUDE) $@
$(MAKE) -C src BOXES_PLATFORM=static LEX=$(BX_LEX) YACC=$(BX_YACC) LIBUNISTRING_DIR=$(LIBUNISTRING_DIR) \
PCRE2_DIR=$(PCRE2_DIR) LIBNCURSES_DIR=$(LIBNCURSES_DIR) LIBNCURSES_WIN_INCLUDE=$(LIBNCURSES_WIN_INCLUDE) $@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -176,7 +158,7 @@ $(OUT_DIR)/zip/$(PKG_NAME).zip:
@echo Windows ZIP file created at $(OUT_DIR)/zip/$(PKG_NAME).zip
package: build
$(MAKE) BOXES_PLATFORM=$(BOXES_PLATFORM) $(PKG_NAME).tar.gz
$(MAKE) BOXES_PLATFORM=unix $(PKG_NAME).tar.gz
win32.package: win32 $(OUT_DIR)/zip/$(PKG_NAME).zip
@ -211,11 +193,11 @@ covtest:
cd test; ./testrunner.sh --suite --coverage
utest:
$(MAKE) -C utest BOXES_PLATFORM=$(BOXES_PLATFORM) utest
$(MAKE) -C utest BOXES_PLATFORM=unix utest
win32.utest: $(OUT_DIR)
cp $(WIN_CMOCKA_DIR)/bin/cmocka.dll $(OUT_DIR)/
$(MAKE) -C utest BOXES_PLATFORM=$(BOXES_PLATFORM) C_INCLUDE_PATH=../$(PCRE2_DIR)/src:../$(WIN_CMOCKA_DIR)/include \
$(MAKE) -C utest BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src:../$(WIN_CMOCKA_DIR)/include \
LDFLAGS_ADDTL="-L../$(PCRE2_DIR)/.libs -L../$(WIN_CMOCKA_DIR)/lib" utest

View File

@ -32,7 +32,7 @@ ORIG_SRC = $(ORIG_GEN) $(ORIG_NORM)
ORIG_FILES = $(ORIG_SRC) $(ORIG_HDR)
.PHONY: boxes.static check_dir clean build cov debug package static flags_unix flags_darwin flags_static flags_win32 flags_
.PHONY: boxes.static check_dir clean build cov debug package static flags_unix flags_static flags_win32 flags_
.NOTPARALLEL:
@ -76,7 +76,7 @@ boxes.exe: $(ALL_OBJ) | check_dir
if [ "$(STRIP)" = "true" ] ; then strip $@ ; fi
flags_unix flags_darwin:
flags_unix:
$(eval CFLAGS := -I. -I$(SRC_DIR) -Wall -W $(CFLAGS_ADDTL))
$(eval LDFLAGS := $(LDFLAGS) $(LDFLAGS_ADDTL))
$(eval BOXES_EXECUTABLE_NAME := boxes)

View File

@ -22,7 +22,7 @@ VPATH = $(SRC_DIR):$(SRC_DIR)/misc:$(UTEST_DIR)
UTEST_NORM = global_mock.c bxstring_test.o cmdline_test.c tools_test.c regulex_test.o main.o unicode_test.o \
utest_tools.o
.PHONY: check_dir flags_unix flags_darwin flags_win32 flags_ utest
.PHONY: check_dir flags_unix flags_win32 flags_ utest
.NOTPARALLEL:
@ -41,12 +41,6 @@ flags_unix:
$(eval UTEST_EXECUTABLE_NAME := unittest)
$(eval UTEST_OBJ := $(UTEST_NORM:.c=.o))
flags_darwin:
$(eval CFLAGS := -I. -I$(SRC_DIR) -O -Wall -W -Wno-stringop-overflow $(CFLAGS_ADDTL))
$(eval LDFLAGS := $(LDFLAGS) --coverage $(LDFLAGS_ADDTL))
$(eval UTEST_EXECUTABLE_NAME := unittest)
$(eval UTEST_OBJ := $(UTEST_NORM:.c=.o))
flags_win32:
$(eval CFLAGS := -Os -s -std=c99 -m32 -I. -I$(SRC_DIR) -Wall -W $(CFLAGS_ADDTL))
$(eval LDFLAGS := $(LDFLAGS) -s -std=c99 -m32 $(LDFLAGS_ADDTL))