diff options
| author | EuAndreh <eu@euandre.org> | 2024-08-12 16:38:19 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2024-08-14 16:57:23 -0300 |
| commit | 5515fe0b549624a6e36ddc6d3889d833e95f3c6c (patch) | |
| tree | 3911532619e656389886b548e265fc58fd75f68a /Makefile | |
| parent | Build with "go tool" and hackishly bundle code from same package into one fil... (diff) | |
| download | golite-5515fe0b549624a6e36ddc6d3889d833e95f3c6c.tar.gz golite-5515fe0b549624a6e36ddc6d3889d833e95f3c6c.tar.xz | |
tests/golite.go: Run tests
Use in-memory databases over disk: decrease test time from minutes to
seconds.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 69 |
1 files changed, 34 insertions, 35 deletions
@@ -33,39 +33,36 @@ all: include deps.mk -cgo-sources = \ - src/_cgo_export.c \ - src/_cgo_export.h \ - src/_cgo_main.c \ - src/_cgo_gotypes.go \ - src/_cgo_import.go \ - src/$(NAME).cgo1.go \ - src/$(NAME).cgo2.c \ - -libdeps = \ +cgo.go = \ src/_cgo_import.go \ src/_cgo_gotypes.go \ src/$(NAME).cgo1.go \ -objects = \ - src/$(NAME).a \ - tests/$(NAME).a \ - tests/main.a \ - $(cgo-sources) \ - src/_cgo_.o \ +cgo.c = \ + src/_cgo_export.c \ + src/$(NAME).cgo2.c \ + +cgo.o = $(cgo.c:.c=.o) sources = \ src/$(NAME).go \ derived-assets = \ - $(objects) \ + src/_cgo_.o \ + $(cgo.go) \ + $(cgo.c) \ + $(cgo.o) \ + src/$(NAME).a \ + tests/$(NAME).a \ + tests/main.a \ + tests/libbuild.a \ tests/main.bin \ - pack2.sentinel \ - src/_cgo_export.o \ - src/$(NAME).cgo2.o \ + tests/libbuild.bin \ side-assets = \ + src/_cgo_export.h \ + src/_cgo_main.c \ @@ -76,39 +73,41 @@ all: $(derived-assets) $(objects): Makefile -# src/$(NAME).a: src/$(NAME).go -tests/main.a: tests/main.go tests/$(NAME).a -tests/main.a: - go tool compile $(GOCFLAGS) -o $@ -p $(*F) -I $(@D) $*.go - -$(cgo-sources): src/_cgo_.o +$(cgo.go) $(cgo.c): src/_cgo_.o src/_cgo_.o: src/$(NAME).go go tool cgo --objdir $(@D) src/$(NAME).go src/_cgo_import.go: src/_cgo_.o go tool cgo --dynpackage $(NAME) --dynimport src/_cgo_.o --dynout $@ -src/$(NAME).a: $(libdeps) - go tool compile $(GOCFLAGS) -o $@ -p $(*F) $(libdeps) +src/$(NAME).a: $(cgo.go) $(cgo.o) + go tool compile $(GOCFLAGS) -o $@ -p $(*F) $(cgo.go) + go tool pack r $@ $(cgo.o) -# FIXME dependency -pack2.sentinel: src/$(NAME).a src/_cgo_export.o src/$(NAME).cgo2.o - go tool pack r $@ src/_cgo_export.o src/$(NAME).cgo2.o - touch $@ +tests/$(NAME).a: tests/$(NAME).go $(cgo.go) $(cgo.o) + go tool compile $(GOCFLAGS) -o $@ -p $(*F) $(cgo.go) $*.go + go tool pack r $@ $(cgo.o) -tests/$(NAME).a: tests/$(NAME).go src/_cgo_gotypes.go src/$(NAME).cgo1.go src/_cgo_import.go src/_cgo_export.o src/$(NAME).cgo2.o - go tool compile $(GOCFLAGS) -o $@ -p $(*F) tests/$(NAME).go src/_cgo_gotypes.go src/$(NAME).cgo1.go src/_cgo_import.go - go tool pack r $@ src/_cgo_export.o src/$(NAME).cgo2.o +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 '-lsqlite3' $*.a +tests/libbuild.bin: tests/libbuild.a + go tool link $(GOLDFLAGS) -o $@ -L src --extldflags '-lsqlite3' $*.a + tests.bin-check = \ tests/main.bin-check \ + tests/libbuild.bin-check \ tests/main.bin-check: tests/main.bin +tests/libbuild.bin-check: tests/libbuild.bin $(tests.bin-check): $(EXEC)$*.bin |
