Update Makefile
This commit is contained in:
parent
a74e6caae1
commit
2969a7479e
3 changed files with 20 additions and 5 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
||||||
.nvim.lua
|
build/
|
||||||
kilo
|
kilo
|
||||||
|
|
||||||
compile_commands.json
|
|
||||||
.ccls-cache
|
.ccls-cache
|
||||||
|
.nvim.lua
|
||||||
|
compile_commands.json
|
||||||
|
|
20
Makefile
20
Makefile
|
@ -1,7 +1,21 @@
|
||||||
CFLAGS := -ggdb -Wall -Wextra -Wstrict-prototypes -std=c99
|
SRCS := $(wildcard src/*.c)
|
||||||
|
OBJS := $(SRCS:src/%.c=build/%.o)
|
||||||
|
DEPS := $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
kilo: kilo.c
|
WARNING_FLAGS := -Wall -Wextra
|
||||||
$(CC) $(CFLAGS) kilo.c -o kilo
|
INCLUDE_FLAGS := -I headers
|
||||||
|
|
||||||
|
CFLAGS := $(WARNING_FLAGS) $(INCLUDE_FLAGS) -MMD -MP -std=c99
|
||||||
|
|
||||||
|
kilo: $(OBJS)
|
||||||
|
$(CC) $(CFLAGS) $^ -o $@
|
||||||
|
|
||||||
|
$(OBJS): build/%.o: src/%.c
|
||||||
|
@mkdir -p build
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
rm -rf build
|
||||||
rm -f ./kilo
|
rm -f ./kilo
|
||||||
|
|
||||||
|
-include $(DEPS)
|
||||||
|
|
Reference in a new issue