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

WIP Changes for OSX #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
64 changes: 64 additions & 0 deletions api/liboni/Makefile.osx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# "make help" prints help.
SHELL := /bin/bash
NAME := liboni
SNAME := $(NAME).a
DNAME := $(NAME).dylib
DNAMELN := $(NAME).1.dylib
HDR := oni.h onidefs.h onix.h onidriver.h oelogo.h # Public headers to be installed
SRC := oni.c onix.c
POSIX_SRC := onidriverloader.c
OBJ := $(SRC:.c=.o)
POSIX_OBJ := $(POSIX_SRC:.c=.o)
CFLAGS := -Wall -W -Werror -fPIC -O3
ISOCFLAGS := -pedantic
LDFLAGS := -L.
PREFIX := /usr/local

# Turn wildcard list into comma separated list
SPACE :=
SPACE += # $SPACE is a SPACE
COMMA := ,
COMMA-SEPARATE = $(subst ${SPACE},${COMMA},$(strip $1))

.PHONY: all
all: $(SNAME) $(DNAME) ## Make release version of liboni.

.PHONY: debug
debug: CFLAGS += -DDEBUG -g3 ## Make liboni with debug symbols.
debug: all

.PHONY: install
install: $(SNAME) $(DNAME) ## Install driver. Defaults to make install PREFIX=/usr
@[ -d $(DESTDIR)$(PREFIX)/lib ] || mkdir -p $(DESTDIR)$(PREFIX)/lib
@[ -d $(DESTDIR)$(PREFIX)/include ] || mkdir -p $(DESTDIR)$(PREFIX)/include
cp $(DNAME) $(DESTDIR)$(PREFIX)/lib/$(DNAME)
cp $(SNAME) $(DESTDIR)$(PREFIX)/lib/$(SNAME)
cp $(HDR) $(DESTDIR)$(PREFIX)/include
@[ -d $(DESTDIR)$(PREFIX)/lib/$(DNAMELN) ] || $(RM) $(DESTDIR)$(PREFIX)/lib/$(DNAMELN)
ln -s $(DESTDIR)$(PREFIX)/lib/$(DNAME) $(DESTDIR)$(PREFIX)/lib/$(DNAMELN)


.PHONY: uninstall
uninstall: ## Remove liboni from installation directory.
$(RM) $(DESTDIR)$(PREFIX)/lib/$(SNAME)
$(RM) $(DESTDIR)$(PREFIX)/lib/$(DNAME)
$(RM) $(DESTDIR)$(PREFIX)/lib/$(DNAMELN)
$(RM) $(DESTDIR)$(PREFIX)/include/{$(call COMMA-SEPARATE,${HDR})}

$(SNAME): $(OBJ) $(POSIX_OBJ)
$(AR) $(ARFLAGS) $@ $^

$(DNAME): LDFLAGS += -dynamiclib
$(DNAME): $(OBJ) $(POSIX_OBJ)
$(CC) $(LDFLAGS) $^ -o $@

$(OBJ): CFLAGS += $(ISOCFLAGS)

.PHONY: clean
clean: ## Remove local build objects
$(RM) $(OBJ) $(POSIX_OBJ)
$(RM) $(SNAME) $(DNAME)

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
55 changes: 55 additions & 0 deletions api/liboni/drivers/ft600/Makefile.osx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# "make help" prints help.
SHELL := /bin/bash
NAME := libonidriver_ft600
DNAME := $(NAME).dylib
DNAMELN := $(NAME).1.dylib
SRC := onidriver_ft600.c circbuffer.c
OBJ := $(SRC:.c=.o)
FT_PATH := ./ft3dxx/osx
CFLAGS := -pedantic -Wall -W -Werror -fPIC -O2 -g $(DEFS) -I$(FT_PATH)
LDFLAGS := -L. -L$(FT_PATH)
LIBS := -lftd3xx -lpthread
PREFIX := /usr/local

# Turn wildcard list into comma separated list
SPACE :=
SPACE += # $SPACE is a SPACE
COMMA := ,
COMMA-SEPARATE = $(subst ${SPACE},${COMMA},$(strip $1))

.PHONY: all
all: $(DNAME) ## Make release version of onidriver_ft600.

.PHONY: debug
debug: CFLAGS += -DDEBUG -g3 ## Make driver with debug symbols.
debug: all

.PHONY: install
install: $(SNAME) $(DNAME) ## Install driver. Defaults to make install PREFIX=/usr/local.
@[ -d $(DESTDIR)$(PREFIX)/lib ] || mkdir -p $(DESTDIR)$(PREFIX)/lib
@[ -d $(DESTDIR)$(PREFIX)/include ] || mkdir -p $(DESTDIR)$(PREFIX)/include
cp $(DNAME) $(DESTDIR)$(PREFIX)/lib/$(DNAME)
cp $(wildcard $(FT_PATH)/*.so*) $(DESTDIR)$(PREFIX)/lib/
cp $(wildcard $(FT_PATH)/*.h) $(DESTDIR)$(PREFIX)/include/
@[ -d $(DESTDIR)$(PREFIX)/lib/$(DNAMELN) ] || $(RM) $(DESTDIR)$(PREFIX)/lib/$(DNAMELN)
ln -s $(DESTDIR)$(PREFIX)/lib/$(DNAME) $(DESTDIR)$(PREFIX)/lib/$(DNAMELN)
ldconfig
ldconfig -p | grep libonidriver

.PHONY: uninstall
uninstall: ## Remove driver from installation directory.
$(RM) $(DESTDIR)$(PREFIX)/lib/$(DNAME)
$(RM) $(DESTDIR)$(PREFIX)/lib/$(DNAMELN)

$(DNAME): LDFLAGS += -dynamiclib
$(DNAME): $(OBJ)
$(CC) $(LDFLAGS) $^ -o $@ $(LIBS)

.PHONY: clean
clean: ## Remove local build objects
$(RM) $(OBJ)
$(RM) $(DNAME)

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
2 changes: 1 addition & 1 deletion api/liboni/drivers/ft600/circbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ void circBufferRead(circ_buffer_t* buffer, uint8_t* dst, size_t size)
}
rpointer = (rpointer + size) % buffer->size;
buffer->read = rpointer;
}
}
3 changes: 2 additions & 1 deletion api/liboni/drivers/ft600/circbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ int circBufferCanRead(circ_buffer_t* buffer, size_t size);

//These do not check. Check before calling them
void circBufferWrite(circ_buffer_t* buffer, uint8_t* src, size_t size);
void circBufferRead(circ_buffer_t* buffer, uint8_t* dst, size_t size);
void circBufferRead(circ_buffer_t* buffer, uint8_t* dst, size_t size);

Loading