reference idris_net library as idris_net.so for all OSes

This commit is contained in:
Arnaud Bailly 2019-07-29 12:45:38 +02:00
parent fbfa74d48d
commit ec402c3c4a
No known key found for this signature in database
GPG Key ID: 389CC2BC5448321E
2 changed files with 8 additions and 14 deletions

View File

@ -14,16 +14,7 @@ else
OS :=unix OS :=unix
endif endif
ifeq ($(OS),darwin) SHLIB_SUFFIX :=.so
SHLIB_SUFFIX :=.dylib
LIBFLAGS :=-dynamiclib
else ifeq ($(OS),windows)
SHLIB_SUFFIX :=.DLL
LIBFLAGS :=-shared
else
SHLIB_SUFFIX :=.so
LIBFLAGS :=-shared
endif
LIBNAME=idris_net LIBNAME=idris_net
OBJS = $(LIBNAME).o OBJS = $(LIBNAME).o
@ -35,7 +26,7 @@ ifneq ($(OS), windows)
CFLAGS += -fPIC CFLAGS += -fPIC
endif endif
DYLIBTARGET = lib$(LIBNAME)$(SHLIB_SUFFIX) DYLIBTARGET = $(LIBNAME)$(SHLIB_SUFFIX)
LIBTARGET = $(LIBNAME).a LIBTARGET = $(LIBNAME).a
TARGET=${HOME}/.idris2 TARGET=${HOME}/.idris2
@ -48,16 +39,19 @@ $(DYLIBTARGET) : $(OBJS)
$(CC) -o $(DYLIBTARGET) $(LIBFLAGS) -shared $(OBJS) $(CC) -o $(DYLIBTARGET) $(LIBFLAGS) -shared $(OBJS)
install: install:
@if [ -z "${IDRIS2}" ]; then echo 'variable $$IDRIS2 is not set, aborting'; exit 1; fi
${IDRIS2} --install network.ipkg ${IDRIS2} --install network.ipkg
install $(DYLIBTARGET) $(HDRS) $(TARGET)/idris2/network @if ! [ -d $(TARGET)/idris2/network/lib ]; then mkdir $(TARGET)/idris2/network/lib; fi
install $(DYLIBTARGET) $(HDRS) $(TARGET)/idris2/network/lib
clean : clean :
rm -rf $(OBJS) $(LIBTARGET) $(DYLIBTARGET) build rm -rf $(OBJS) $(LIBTARGET) $(DYLIBTARGET) build
test: build test.c test: build test.c
cp $(DYLIBTARGET) lib$(DYLIBTARGET) # to make C linker happy
$(CC) -o network-tests -L. -I. -l$(LIBNAME) test.c $(CC) -o network-tests -L. -I. -l$(LIBNAME) test.c
LD_LIBRARY_PATH=. ./network-tests LD_LIBRARY_PATH=. ./network-tests
LD_LIBRARY_PATH=. ./lib-tests ./lib-tests
$(OBJS): $(HDRS) $(OBJS): $(HDRS)

View File

@ -11,7 +11,7 @@ import Data.Strings
-- ------------------------------------------------------------ [ Type Aliases ] -- ------------------------------------------------------------ [ Type Aliases ]
-- FIXME should be generic name with OS-dependent suffix -- FIXME should be generic name with OS-dependent suffix
%cg chez "libidris_net.dylib" %cg chez "libidris_net.so"
public export public export
ByteLength : Type ByteLength : Type