diff --git a/Makefile b/Makefile index 5502515..8a8caf1 100644 --- a/Makefile +++ b/Makefile @@ -5,18 +5,26 @@ LIBHDT=$(HDTHOME)/libhdt LIBCDS=$(HDTHOME)/libcds HDTLIB=$(LIBHDT)/.libs CDSLIB=$(LIBCDS)/.libs -SOBJ= $(PACKSODIR)/hdt4pl.$(SOEXT) +SOBJ= $(SWIPL_MODULE_DIR)/hdt4pl.$(SWIPL_MODULE_EXT) NPROC:=$(shell expr $$(nproc) + 1) MAKE_J=-j$(NPROC) -CFLAGS+=-I$(LIBHDT)/include -g +CFLAGS=$(SWIPL_CFLAGS) -I$(LIBHDT)/include -g # This doesn't work because the *.so files get picked first: # LIBS= -L$(HDTLIB) -L$(CDSLIB) -lhdt -lcds -# Instead, we copy the *.a files intothe same directory as $(OBJ) +# Instead, we copy the *.a files into the same directory as $(OBJ) # - see the rules for $(OBJ2). LIBS= -Lc -lhdt -lcds OBJ= c/hdt4pl.o OBJ2= c/libcds.a c/libhdt.a -LD=g++ +# WARNING: A previous version of this Makefile set LD=g++ +# ... this confuses hdt-cpp's use of libtool. +# The correct way of using the linker is with $(CC): +# see the "implicit variables" in the GNU make documentation +# Note that pack_version(2) defines `SWIPL_CC` and +# "swipl pack install ." creates ./buildenv.sh, which +# defines the SWIPL_* environment variables + +CC=$(SWIPL_CC) all: $(SOBJ) @@ -27,8 +35,8 @@ c/libcds.a: $(CDSLIB)/libcds.a ln -f $< $@ $(SOBJ): $(OBJ) $(OBJ2) - mkdir -p $(PACKSODIR) - $(LD) $(ARCH) $(LDSOFLAGS) -o $@ $< $(LIBS) $(SWISOLIB) -lserd-0 + mkdir -p $(SWIPL_MODULE_DIR) + $(CC) $(ARCH) $(SWIPL_MODULE_LDFLAGS) -o $@ $< $(LIBS) $(SWIPL_MODULE_LIB) -lserd-0 c/hdt4pl.o: c/hdt4pl.cpp $(HDTLIB)/libhdt.a $(CDSLIB)/libcds.a $(CC) $(ARCH) $(CFLAGS) -c -o $@ c/hdt4pl.cpp @@ -38,6 +46,9 @@ $(HDTLIB)/libhdt.a $(HDTLIB)/libcds.a: FORCE FORCE: +check:: + $(MAKE) -C $(HDTHOME) $(MAKE_J) check + check:: $(SWIPL) -g test_hdt -t halt test/test_hdt.pl @@ -51,3 +62,4 @@ clean: distclean: clean rm -f $(SOBJ) [ ! -f $(HDTHOME)/Makefile ] || $(MAKE) -C $(HDTHOME) distclean + cd $(HDTHOME) && git clean -d -f -x diff --git a/pack.pl b/pack.pl index f8a62f4..7abca1e 100644 --- a/pack.pl +++ b/pack.pl @@ -1,6 +1,7 @@ name(hdt). -version('0.5.3'). -% TODO: swipl_version([90121]). +version('0.5.4'). +pack_version(2). +% swipl_version([90302]). % TODO: add stable version title('Access RDF HDT files'). keywords(['RDF']). author( 'Jan Wielemaker', 'J.Wielemaker@vu.nl' ).