diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 36 |
1 files changed, 25 insertions, 11 deletions
@@ -24,7 +24,7 @@ GOLDFLAGS = -L $(GOLIBDIR) .SUFFIXES: -.SUFFIXES: .go .a .c .o .bin .bin-check +.SUFFIXES: .go .a .c .o .so .bin .bin-check .c.o: $(CC) $(CFLAGS) -o $@ -c $< @@ -35,6 +35,9 @@ all: include deps.mk +functional-tests.a = $(functional-tests.go:.go=.a) +functional-tests.bin = $(functional-tests.go:.go=.bin) + cgo.go = \ src/_cgo_import.go \ src/_cgo_gotypes.go \ @@ -60,9 +63,10 @@ derived-assets = \ src/$(NAME).a \ tests/$(NAME).a \ tests/main.a \ - tests/libbuild.a \ tests/main.bin \ - tests/libbuild.bin \ + $(functional-tests.a) \ + $(functional-tests.bin) \ + tests/functional/streq.so \ side-assets = \ src/_cgo_export.h \ @@ -78,6 +82,8 @@ all: $(derived-assets) $(derived-assets): Makefile deps.mk $(cgo.go) $(cgo.c) $(cgo.o): src/_cgo_.o + + src/_cgo_.o: src/$(NAME).go go tool cgo --objdir $(@D) src/$(NAME).go @@ -95,30 +101,38 @@ tests/$(NAME).a: $(cgo.go) $(cgo.o) src/version.go tests/$(NAME).go tests/main.a: tests/main.go tests/$(NAME).a go tool compile $(GOCFLAGS) -o $@ -p $(*F) -I $(@D) $*.go -tests/libbuild.a: tests/libbuild.go src/$(NAME).a - go tool compile $(GOCFLAGS) -o $@ -p main -I src $*.go - tests/main.bin: tests/main.a go tool link $(GOLDFLAGS) -o $@ -L $(@D) --extldflags '$(LDLIBS)' $*.a -tests/libbuild.bin: tests/libbuild.a - go tool link $(GOLDFLAGS) -o $@ -L src --extldflags '$(LDLIBS)' $*.a - src/version.go: Makefile echo 'package $(NAME); const Version = "$(VERSION)"' > $@ +$(functional-tests.a): src/$(NAME).a + go tool compile $(GOCFLAGS) -o $@ -p main -I src $*.go + +$(functional-tests.bin): + go tool link $(GOLDFLAGS) -o $@ -L src --extldflags '$(LDLIBS)' $*.a + +tests/functional/streq.so: tests/functional/streq.c + $(CC) $(CFLAGS) $(LDFLAGS) -fPIC --shared -o $@ $*.c + + + +tests/functional/extension.bin-check: tests/functional/streq.so + LD_LIBRARY_PATH=$(@D) $(EXEC)$*.bin +functional-tests.bin-check = $(functional-tests-butone.go:.go=.bin-check) tests.bin-check = \ tests/main.bin-check \ - tests/libbuild.bin-check \ + $(functional-tests.bin-check) \ tests/main.bin-check: tests/main.bin -tests/libbuild.bin-check: tests/libbuild.bin $(tests.bin-check): $(EXEC)$*.bin check-unit: $(tests.bin-check) +check-unit: tests/functional/extension.bin-check integration-tests = \ |