Skip to content

Commit 3526789

Browse files
committed
Set version via make
1 parent 2e83b5f commit 3526789

File tree

Image for: File tree

3 files changed

Image for: 3 files changed
+7
-3
lines changed

3 files changed

Image for: 3 files changed
+7
-3
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ regression.out
1313
/semver_binary_copy.bin
1414
/.vscode
1515
/*.bin
16+
/src/*.c

‎Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ DOCS = $(wildcard doc/*.mmd)
1010
TESTS = $(wildcard test/sql/*.sql)
1111
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
1212
REGRESS_OPTS = --inputdir=test
13-
MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
13+
MODULES = src/$(EXTENSION)
1414
PG_CONFIG ?= pg_config
15-
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql
15+
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql src/$(EXTENSION).c
1616
PG92 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0| 9\.1" && echo no || echo yes)
1717

1818
ifeq ($(PG92),no)
@@ -27,6 +27,9 @@ all: sql/$(EXTENSION)--$(EXTVERSION).sql
2727
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
2828
cp $< $@
2929

30+
src/$(EXTENSION).c: src/$(EXTENSION).c.in
31+
sed -e 's,__VERSION__,$(EXTVERSION),g' $< > $@
32+
3033
.PHONY: results
3134
results:
3235
rsync -avP --delete results/ test/expected

‎src/semver.c renamed to ‎src/semver.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#endif
2626

2727
#ifdef PG_MODULE_MAGIC_EXT // Added in 18
28-
PG_MODULE_MAGIC_EXT(.name = "semver", .version = "0.32.1");
28+
PG_MODULE_MAGIC_EXT(.name = "semver", .version = "__VERSION__");
2929
#else
3030
PG_MODULE_MAGIC; // Added in 8.2
3131
#endif

0 commit comments

Image for: 0 commit comments
Comments
 (0)