diff options
author | cflip <cflip@cflip.net> | 2023-01-10 14:15:20 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2023-01-10 14:20:34 -0700 |
commit | 0cd5d2b28f7529f4f9f7b31b9f54e76ada76d9b7 (patch) | |
tree | 24d37e40750ecffaec29f05298af7a837b3710a6 | |
parent | 9347cf115a12cee9ad3bf9ed18d23ca5336ec0e9 (diff) |
Improve makefile
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 36 |
2 files changed, 26 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e0b65a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +editor +*.o +*.swp @@ -1,17 +1,27 @@ -CFLAGS=-std=c99 -g +CFLAGS=-std=c99 -g -Wall LFLAGS=-lSDL2 OUT=editor -SRC=main.c \ - buffer.c \ - editor.c \ - file.c \ - font.c \ - input.c \ - row.c \ - syntax.c \ - terminal.c \ - window.c +OBJS=main.o \ + buffer.o \ + editor.o \ + file.o \ + font.o \ + input.o \ + row.o \ + syntax.o \ + terminal.o \ + window.o -${OUT}: ${SRC} - ${CC} ${CFLAGS} ${LFLAGS} ${SRC} -o ${OUT} +.PHONY: all clean + +all: $(OUT) + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +${OUT}: $(OBJS) + $(CC) $(LFLAGS) $^ -o $@ + +clean: + rm -f $(OBJS) $(OUT) |