Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build ser2tcp as a universal binary #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions tools/ser2tcp/eg_c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,30 @@ STAPP=sertest$(EXT)

CFLAGS=$(OPT) -Wall -Wextra -pedantic -std=gnu17

all: $(APP)
TARGETS:=$(APP)

ifeq ($(XOS),Darwin)
CFLAGS+= -target x86_64-apple-macos11
TARGETS:=universal
ARMAPP:=$(APP).arm64
APP:=$(APP).x64
endif



all: $(TARGETS)

$(APP): ser2tcp.c serial.c find_best.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)


$(ARMAPP): ser2tcp.c serial.c find_best.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) -target arm64-apple-macos11

universal: $(APP) $(ARMAPP)
lipo -create -output ser2tcp $^


static: ser2tcp.c serial.c find_best.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $(APP) $(STATIC) $^ $(LIBS)

Expand All @@ -39,4 +58,4 @@ install: $(APP)
install -s -m 755 $(APP) $(prefix)/bin/

clean:
rm -f *.o *.exe ser2tcp sertest ~*
rm -f *.o *.exe ser2tcp sertest ser2tcp *.swp *~