|
|
@ -2,10 +2,40 @@ CFLAGS = -I/opt/homebrew/include -O2 -Wall -Wextra
|
|
|
|
LDFLAGS = -L/opt/homebrew/lib -lglfw -lvulkan -ldl
|
|
|
|
LDFLAGS = -L/opt/homebrew/lib -lglfw -lvulkan -ldl
|
|
|
|
CC = gcc
|
|
|
|
CC = gcc
|
|
|
|
|
|
|
|
|
|
|
|
SOURCES = $(wildcard $(SRC)/*.c)
|
|
|
|
SOURCES = $(wildcard src/*.c)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spacegame: $(OBJECTS)
|
|
|
|
|
|
|
|
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.compdb/%.compdb_entry: %.c
|
|
|
|
|
|
|
|
@mkdir -p $(shell dirname $@)
|
|
|
|
|
|
|
|
@echo " {" > $@
|
|
|
|
|
|
|
|
@echo " \"command\": \"$(CC) $(CFLAGS) -c $<\"," >> $@
|
|
|
|
|
|
|
|
@echo " \"directory\": \"$(CURDIR)\"," >> $@
|
|
|
|
|
|
|
|
@echo " \"file\": \"$<\"" >> $@
|
|
|
|
|
|
|
|
@echo " }," >> $@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
COMPDB_ENTRIES = $(addprefix .compdb/, $(addsuffix .compdb_entry, $(basename $(SOURCES))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compile_commands.json: $(COMPDB_ENTRIES)
|
|
|
|
|
|
|
|
@echo "[" > $@.tmp
|
|
|
|
|
|
|
|
@cat $^ >> $@.tmp
|
|
|
|
|
|
|
|
@sed '$$d' < $@.tmp > $@
|
|
|
|
|
|
|
|
@echo " }" >> $@
|
|
|
|
|
|
|
|
@echo "]" >> $@
|
|
|
|
|
|
|
|
@rm $@.tmp
|
|
|
|
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
|
|
|
|
|
|
|
|
spacegame: src/main.o
|
|
|
|
.PHONY: clean clean_compdb
|
|
|
|
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
|
|
|
rm $(OBJECTS)
|
|
|
|
|
|
|
|
rm spacegame
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clean_compdb:
|
|
|
|
|
|
|
|
rm -rf .compdb
|
|
|
|
|
|
|
|
rm compile_commands.json
|
|
|
|