Fix some OSX build inelegancies.

This commit is contained in:
David Given
2021-06-19 12:24:47 +02:00
parent bc3d3cabce
commit 34dfc2767f
3 changed files with 16 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ export CFLAGS = -x c++ --std=c++14 -ffunction-sections -fdata-sections
export LDFLAGS = -pthread export LDFLAGS = -pthread
export COPTFLAGS = -Os export COPTFLAGS = -Os
export LDOPTFLAGS = -Os -s export LDOPTFLAGS = -Os
export CDBGFLAGS = -O0 -g export CDBGFLAGS = -O0 -g
export LDDBGFLAGS = -O0 -g export LDDBGFLAGS = -O0 -g
@@ -16,7 +16,8 @@ endif
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
export PROTOC = /mingw32/bin/protoc export PROTOC = /mingw32/bin/protoc
export CXX = /mingw32/bin/g++ export CXX = /mingw32/bin/g++
export AR = /mingw32/bin/ar rcs export AR = /mingw32/bin/ar rc
export RANLIB = /mingw32/bin/ranlib -c
export STRIP = /mingw32/bin/strip export STRIP = /mingw32/bin/strip
export CFLAGS += -I/mingw32/include/libusb-1.0 -I/mingw32/include export CFLAGS += -I/mingw32/include/libusb-1.0 -I/mingw32/include
export LDFLAGS += export LDFLAGS +=
@@ -32,7 +33,8 @@ endif
export PROTOC = protoc export PROTOC = protoc
export CXX = g++ export CXX = g++
export AR = ar rcs export AR = ar rc
export RANLIB = ranlib -c
export STRIP = strip export STRIP = strip
export CFLAGS += $(shell pkg-config --cflags $(PACKAGES)) export CFLAGS += $(shell pkg-config --cflags $(PACKAGES))
export LDFLAGS += export LDFLAGS +=
@@ -41,13 +43,18 @@ export EXTENSION =
endif endif
export XXD = xxd export XXD = xxd
ifeq ($(shell uname),Darwin)
AR = ar rcS
RANLIB += -no_warning_for_no_symbols
endif
CFLAGS += -Ilib -Idep/fmt -Iarch CFLAGS += -Ilib -Idep/fmt -Iarch
export OBJDIR = .obj export OBJDIR = .obj
all: .obj/build.ninja all: .obj/build.ninja
@ninja -f .obj/build.ninja @ninja -f .obj/build.ninja
@-cscope -bRq @(command -v cscope > /dev/null) && cscope -bRq
clean: clean:
@echo CLEAN @echo CLEAN

View File

@@ -186,7 +186,8 @@ install some support packages.
- For Linux (this is Ubuntu, but this should apply to Debian too): - For Linux (this is Ubuntu, but this should apply to Debian too):
`ninja-build`, `libusb-1.0-0-dev`, `libsqlite3-dev`, `zlib1g-dev`, `ninja-build`, `libusb-1.0-0-dev`, `libsqlite3-dev`, `zlib1g-dev`,
`libudev-dev`. `libudev-dev`.
- For OSX with Homebrew: `ninja`, `libusb`, `pkg-config`, `sqlite`. - For OSX with Homebrew: `ninja`, `libusb`, `pkg-config`, `sqlite`,
`protobuf`.
- For Windows with MSYS2: `make`, `ninja`, `mingw-w64-i686-libusb`, - For Windows with MSYS2: `make`, `ninja`, `mingw-w64-i686-libusb`,
`mingw-w64-i686-protobuf`, `mingw-w64-i686-sqlite3`, `mingw-w64-i686-zlib`, `mingw-w64-i686-protobuf`, `mingw-w64-i686-sqlite3`, `mingw-w64-i686-zlib`,
`mingw-w64-i686-gcc`. `mingw-w64-i686-gcc`.

View File

@@ -24,7 +24,7 @@ rule binencode
restat = true restat = true
rule library rule library
command = $AR \$out \$in command = $AR \$out \$in && $RANLIB \$out
description = AR \$in description = AR \$in
rule link rule link
@@ -186,9 +186,10 @@ buildprogram() {
echo build $prog-debug$EXTENSION : link $dobjs echo build $prog-debug$EXTENSION : link $dobjs
echo " flags=$flags $LDDBGFLAGS" echo " flags=$flags $LDDBGFLAGS"
echo build $prog$EXTENSION : link $oobjs echo build $prog$EXTENSION-unstripped : link $oobjs
echo " flags=$flags $LDOPTFLAGS" echo " flags=$flags $LDOPTFLAGS"
echo build $prog$EXTENSION : strip $prog$EXTENSION-unstripped
} }
buildsimpleprogram() { buildsimpleprogram() {