# Makefile for the C frontends of tazinst.
#
PREFIX ?= /usr
DESTDIR ?=
CC ?= cc
CFLAGS ?= -Os -Wall
GTK_CFLAGS = $(shell pkg-config --cflags gtk+-3.0)
GTK_LIBS = $(shell pkg-config --libs gtk+-3.0)

all: tazinst-tui tazinst-gtk

tazinst-tui: tazinst-tui.o proto.o
	$(CC) $(LDFLAGS) -o $@ tazinst-tui.o proto.o -lncursesw

tazinst-gtk: tazinst-gtk.o proto.o
	$(CC) $(LDFLAGS) -o $@ tazinst-gtk.o proto.o $(GTK_LIBS)

tazinst-tui.o: tazinst-tui.c proto.h
tazinst-gtk.o: tazinst-gtk.c proto.h
	$(CC) $(CFLAGS) $(GTK_CFLAGS) -c tazinst-gtk.c
proto.o: proto.c proto.h

install: all
	mkdir -p $(DESTDIR)$(PREFIX)/sbin
	install -m 0755 tazinst-tui tazinst-gtk $(DESTDIR)$(PREFIX)/sbin

clean:
	rm -f *.o tazinst-tui tazinst-gtk

.PHONY: all install clean
