# Makefile for cook-tui - ncurses front-end for SliTaz cook.

PREFIX  ?= /usr
DESTDIR ?=

CC      ?= cc
CFLAGS  ?= -O2 -Wall -Wextra -std=c11 -D_GNU_SOURCE
LDFLAGS ?=
# Link ncursesw (wide): SliTaz is UTF-8 and package descriptions / the UI
# carry accents. With the locale set (setlocale at startup), ncursesw counts
# real column widths (wcwidth) for addstr/mvprintw; narrow ncurses miscounts
# multibyte chars and misaligns the list at the first accented description.
LIBS    ?= -lncursesw

all: cook-tui

cook-tui: cook-tui.c
	$(CC) $(CFLAGS) -o $@ cook-tui.c $(LDFLAGS) $(LIBS)

install: cook-tui
	install -m 0755 -d $(DESTDIR)$(PREFIX)/bin
	install -m 0755 cook-tui $(DESTDIR)$(PREFIX)/bin

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/cook-tui

clean:
	rm -f cook-tui

.PHONY: all install uninstall clean
