diff --git a/.gitignore b/.gitignore index f5bbd38fe..2d36a4c81 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,4 @@ Carthage # local stuff data/ glean-core/data -glean_app +glean_app* diff --git a/glean-core/ffi/examples/Makefile b/glean-core/ffi/examples/Makefile index ebdf4bcb3..09638c054 100644 --- a/glean-core/ffi/examples/Makefile +++ b/glean-core/ffi/examples/Makefile @@ -1,12 +1,24 @@ -objects = glean_app.c $(wildcard ../../../target/release/libglean_ffi.so) $(wildcard ../../../target/release/libglean_ffi.dylib) -headers = glean.h +SRC = glean_app.c +HEADERS = glean.h -glean_app: $(objects) $(headers) - $(CC) $(CFLAGS) -o $@ $(objects) +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + OBJECTS_RELEASE = ../../../target/release/libglean_ffi.so + OBJECTS_DEBUG = ../../../target/debug/libglean_ffi.so +endif +ifeq ($(UNAME_S),Darwin) + OBJECTS_RELEASE = ../../../target/release/libglean_ffi.dylib + OBJECTS_DEBUG = ../../../target/debug/libglean_ffi.dylib +endif +glean_app: $(SRC) $(OBJECTS_DEBUG) $(HEADERS) + $(CC) $(CFLAGS) -o $@ $(SRC) $(OBJECTS_DEBUG) -../../../target/debug/libglean_ffi.dylib: ../src/lib.rs +glean_app_release: $(SRC) $(OBJECTS_RELEASE) $(HEADERS) + $(CC) $(CFLAGS) -o $@ $(SRC) $(OBJECTS_RELEASE) + +$(OBJECTS_DEBUG): ../src/lib.rs cargo build -../../../target/release/libglean_ffi.dylib: ../src/lib.rs +$(OBJECTS_RELEASE): ../src/lib.rs cargo build --release diff --git a/glean-core/ffi/examples/glean_app.c b/glean-core/ffi/examples/glean_app.c index 964511f76..7e7012302 100644 --- a/glean-core/ffi/examples/glean_app.c +++ b/glean-core/ffi/examples/glean_app.c @@ -3,12 +3,6 @@ #include #include -// Not exported in glean.h right now. -typedef struct ExternError { - uint32_t code; - char *message; -} ExternError; - #include "glean.h" int main(void)