CFLAGS += $(shell pkg-config --cflags json-c)
LDFLAGS += $(shell pkg-config --libs json-c)

all: boot-managed-by-snapd
	$(MAKE) -C po $@

boot-managed-by-snapd: boot-managed-by-snapd.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -o boot-managed-by-snapd boot-managed-by-snapd.c $(LDLIBS) $(LDFLAGS)

install: boot-managed-by-snapd
	install -D -m755 boot-managed-by-snapd $(DESTDIR)/usr/libexec/boot-managed-by-snapd
	install -D -m644 20boot-managed-by-snapd.conf $(DESTDIR)/etc/apt/apt.conf.d/20boot-managed-by-snapd.conf

clean:
	$(RM) boot-managed-by-snapd
	$(MAKE) -C po clean
