nostrpgx / Makefile
a year ago
Chris Daley
25ba7715
github.com (via proxy) fetching

Makefile

1
EXTENSION = nostr_filter
2
DATA = nostr_filter.control nostr_filter--1.0.sql nostr_events_table.sql nostr_insert.sql nostr_event_type.sql nostr_custom_type.sql
3
MODULE_big = nostr_filter
4
OBJS = nostr_filter.o nostr.o nostr_insert.o nostr_custom_type.o
5

6
# Use the VCPKG_ROOT environment variable
7
VCPKG_ROOT ?= $(shell echo $${VCPKG_ROOT})
8
VCPKG_TRIPLET = x64-linux
9
VCPKG_INSTALLED = $(VCPKG_ROOT)/installed/$(VCPKG_TRIPLET)
10

11
# Print environment variables for debugging
12
$(info VCPKG_ROOT=$(VCPKG_ROOT))
13
$(info VCPKG_INSTALLED=$(VCPKG_INSTALLED))
14

15
CFLAGS += -I$(VCPKG_INSTALLED)/include
16
LDFLAGS += -L$(VCPKG_INSTALLED)/lib -ljson-c
17
CPPFLAGS += -I$(VCPKG_INSTALLED)/include
18

19
# Append custom flags
20
PG_CFLAGS = -Wno-declaration-after-statement
21
PG_CPPFLAGS = -I$(VCPKG_INSTALLED)/include
22
PG_LDFLAGS = -L$(VCPKG_INSTALLED)/lib -ljson-c 
23

24
EXTRA_CLEAN = test_nostr_filter test_nostr_filter.o nostr.o nostr_tests.o
25

26
PG_CONFIG = pg_config
27
PGXS := $(shell $(PG_CONFIG) --pgxs)
28
include $(PGXS)
29

30
# Custom build rule for debugging
31
%.o: %.c
32
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
33
	@echo "gcc $(CPPFLAGS) $(CFLAGS) -c $< -o $@"
34

35
# Rule to build the test application
36
test_nostr_filter: nostr.o test_nostr_filter.o nostr_tests.o
37
	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS)
38

39
gitworkshop.dev logo GitWorkshop.dev