Update Makefile

This commit is contained in:
Gvidas Juknevičius 2024-05-20 09:21:55 +00:00
parent 06dae8eb4e
commit 409ef7f74e

View File

@ -13,26 +13,26 @@ include lib/make.mk
cxx_sources=$(wildcard src/*.cpp)
c_sources=$(wildcard src/*.c)
objects=$(patsubst src/%.cpp,bin/obj/%.cpp.o,$(cxx_sources)) $(patsubst src/%.c,bin/obj/%.c.o,$(c_sources)) $(LIBS)
objects=$(patsubst src/%.cpp,build/obj/%.cpp.o,$(cxx_sources)) $(patsubst src/%.c,build/obj/%.c.o,$(c_sources)) $(LIBS)
all: bin/$(BIN) compile_commands.json
@rm -r bin/obj
all: build/$(BIN) compile_commands.json
@rm -r build/obj
keep: bin/$(BIN)
keep: build/$(BIN)
clean:
rm -r bin/obj/
rm -r build/obj/
bin/$(BIN): $(objects)
build/$(BIN): $(objects)
$(LD) -o $@ $^ $(LD_FLAGS)
bin/obj/%.cpp.o: */%.cpp
build/obj/%.cpp.o: */%.cpp
@mkdir -p $(dir $@)
$(CXX) -c -o $@ $< $(CXX_FLAGS)
bin/obj/%.c.o: */%.c
build/obj/%.c.o: */%.c
@mkdir -p $(dir $@)
$(CC) -c -o $@ $< $(CC_FLAGS)