EXEC_FILE=editor
CFLAGS=

all: $(EXEC_FILE)

$(EXEC_FILE): $(EXEC_FILE).o
	gcc $(CFLAGS) -o $@ $^ -lncurses

$(EXEC_FILE).o: $(EXEC_FILE).c
	gcc $(CFLAGS) -c -o $@ $^

.PHONY: debug
debug: CFLAGS+=-g
debug: $(EXEC_FILE)

.PHONY: allwarn
allwarn: CFLAGS+=-Wall -Wextra -pedantic
allwarn: $(EXEC_FILE)

.PHONY: clean
clean:
	rm $(EXEC_FILE)
	rm $(EXEC_FILE).o