Skip to content

Commit 7245664

Browse files
committed
Makefile: fix compilation into the right PACKSODIR and fix LDFLAGS
1 parent 89fbd5e commit 7245664

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ DOCKER_SWIPL=8.1.12
55
DOCKER_JANSSON=2.12
66
DOCKER_LIBJWT=1.12.0
77

8+
PACKSODIR=$(shell swipl -q -g "use_module(library(prolog_pack)), prolog_pack:def_environment('PACKSODIR', X), writeln(X)." -t halt)
89
JWTLDFLAGS=$(shell pkg-config --libs libjwt)
910
JWTCFLAGS=$(shell pkg-config --cflags libjwt)
1011
SSLLDFLAGS=-lssl -lcrypto
@@ -17,28 +18,27 @@ LIBNAME=jwt_io
1718

1819
testfiles := $(wildcard tests/*.plt)
1920

20-
all: $(LIBNAME).$(LIBEXT)
21+
all: $(PACKSODIR)/$(LIBNAME).$(LIBEXT)
2122

22-
$(LIBNAME).$(LIBEXT): src/$(LIBNAME).o
23-
$(CC) $(LDFLAGS) -o $@ $<
23+
$(PACKSODIR)/$(LIBNAME).$(LIBEXT): src/$(LIBNAME).o
24+
$(CC) -o $@ $< $(LDFLAGS)
2425

2526
%.o: %.c
26-
swipl-ld $(CFLAGS) $<
27+
swipl-ld $(CFLAGS) $< -o $@
2728

28-
check: $(LIBNAME).$(LIBEXT) $(testfiles)
29+
check: $(PACKSODIR)/$(LIBNAME).$(LIBEXT) $(testfiles)
2930

3031
%.plt: FORCE
3132
swipl -s $@ -g run_tests -t halt
3233

3334
install:
3435
mkdir -p $(PACKSODIR)
35-
cp $(LIBNAME).$(LIBEXT) $(PACKSODIR)
3636
swipl -q -g 'doc_pack($(packname))' -t halt
3737

3838
FORCE:
3939

4040
clean:
41-
rm -f src/$(LIBNAME).o $(LIBNAME).$(LIBEXT) Dockerfile .gitlab-ci.yml
41+
rm -f src/$(LIBNAME).o $(PACKSODIR)/$(LIBNAME).$(LIBEXT) Dockerfile .gitlab-ci.yml
4242

4343
make_tgz: FORCE
4444
rm -f ../$(packname)-$(version).tgz

0 commit comments

Comments
 (0)