# $Id: Makefile,v 1.1 2023/10/23 02:34:17 leavens Exp leavens $

CC = gcc
CFLAGS = -Wall -std=c17 -g
RM = rm -f

.DEFAULT: fmtme
fmtme: fmtme.c
	$(CC) $(CFLAGS) $^ -o $@

.PHONY: clean
clean:
	$(RM) *.o
	$(RM) fmtme fmtme.exe

.PHONY: demo demo1 demo2 demo3
demo: fmtme
	./fmtme "hello"

# demo1 is the same, but runs fmtme using perl for later convenience
demo1: fmtme
	perl -e 'system "./fmtme", "hello"'

demo2: fmtme
	perl -e 'system "./fmtme", "abcd\n0x%lx 0x%lx 0x%lx 0x%lx"'

demo3: fmtme
	perl -e 'system "./fmtme", "\xcc\xcb\xff\xff\x07\x00%d%n%x%x%x%x\n"'
