mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-01-20 20:58:35 +01:00
Update Makefile, src/Makefile, and utest/Makefile to support MacOS unit tests
This commit is contained in:
parent
503a81cf9a
commit
5f0db01418
29
Makefile
29
Makefile
@ -44,20 +44,37 @@ 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=unix LEX=$(LEX) YACC=$(YACC) $@
|
||||
$(MAKE) -C src BOXES_PLATFORM=$(BOXES_PLATFORM) LEX=$(LEX) YACC=$(YACC) $@
|
||||
|
||||
win32: infomsg replaceinfos
|
||||
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src LDFLAGS=-L../$(PCRE2_DIR)/.libs \
|
||||
$(MAKE) -C src BOXES_PLATFORM=$(BOXES_PLATFORM) 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=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src LDFLAGS=-L../$(PCRE2_DIR)/.libs \
|
||||
$(MAKE) -C src BOXES_PLATFORM=$(BOXES_PLATFORM) 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
|
||||
|
||||
@ -159,7 +176,7 @@ $(OUT_DIR)/zip/$(PKG_NAME).zip:
|
||||
@echo Windows ZIP file created at $(OUT_DIR)/zip/$(PKG_NAME).zip
|
||||
|
||||
package: build
|
||||
$(MAKE) BOXES_PLATFORM=unix $(PKG_NAME).tar.gz
|
||||
$(MAKE) BOXES_PLATFORM=$(BOXES_PLATFORM) $(PKG_NAME).tar.gz
|
||||
|
||||
win32.package: win32 $(OUT_DIR)/zip/$(PKG_NAME).zip
|
||||
|
||||
@ -194,11 +211,11 @@ covtest:
|
||||
cd test; ./testrunner.sh --suite --coverage
|
||||
|
||||
utest:
|
||||
$(MAKE) -C utest BOXES_PLATFORM=unix utest
|
||||
$(MAKE) -C utest BOXES_PLATFORM=$(BOXES_PLATFORM) utest
|
||||
|
||||
win32.utest: $(OUT_DIR)
|
||||
cp $(WIN_CMOCKA_DIR)/bin/cmocka.dll $(OUT_DIR)/
|
||||
$(MAKE) -C utest BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src:../$(WIN_CMOCKA_DIR)/include \
|
||||
$(MAKE) -C utest BOXES_PLATFORM=$(BOXES_PLATFORM) C_INCLUDE_PATH=../$(PCRE2_DIR)/src:../$(WIN_CMOCKA_DIR)/include \
|
||||
LDFLAGS_ADDTL="-L../$(PCRE2_DIR)/.libs -L../$(WIN_CMOCKA_DIR)/lib" utest
|
||||
|
||||
|
||||
|
@ -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_static flags_win32 flags_
|
||||
.PHONY: boxes.static check_dir clean build cov debug package static flags_unix flags_darwin 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_unix flags_darwin:
|
||||
$(eval CFLAGS := -I. -I$(SRC_DIR) -Wall -W $(CFLAGS_ADDTL))
|
||||
$(eval LDFLAGS := $(LDFLAGS) $(LDFLAGS_ADDTL))
|
||||
$(eval BOXES_EXECUTABLE_NAME := boxes)
|
||||
|
@ -23,7 +23,7 @@ UTEST_NORM = global_mock.c bxstring_test.o cmdline_test.c tools_test.c regulex_t
|
||||
utest_tools.o
|
||||
MOCKS = bx_fprintf
|
||||
|
||||
.PHONY: check_dir flags_unix flags_win32 flags_ utest
|
||||
.PHONY: check_dir flags_unix flags_darwin flags_win32 flags_ utest
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
@ -42,6 +42,12 @@ 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 $(foreach MOCK,$(MOCKS),-Wl,--wrap=$(MOCK)) $(LDFLAGS_ADDTL))
|
||||
|
Loading…
Reference in New Issue
Block a user