mclangc/Makefile

41 lines
726 B
Makefile
Raw Permalink Normal View History

2024-07-23 22:55:53 +00:00
BIN=mclangc
CC_FLAGS = -Isrc/include -std=c23
CXX_FLAGS = -Isrc/include -Ilib/ -std=c++23 -fmodules-ts
LD_FLAGS = -lm
CC=gcc
CXX=g++
LD=gcc
AR=ar
LIBS=
include lib/make.mk
cxx_sources=$(wildcard src/*.cpp)
c_sources=$(wildcard src/*.c)
objects=$(patsubst src/%.cpp,build/obj/%.cpp.o,$(cxx_sources)) $(patsubst src/%.c,build/obj/%.c.o,$(c_sources)) $(LIBS)
all: build/$(BIN) compile_commands.json
@rm -r build/obj
keep: build/$(BIN)
clean:
rm -r build/obj/
build/$(BIN): $(objects)
$(LD) -o $@ $^ $(LD_FLAGS)
build/obj/%.cpp.o: */%.cpp
@mkdir -p $(dir $@)
$(CXX) -c -o $@ $< $(CXX_FLAGS)
build/obj/%.c.o: */%.c
@mkdir -p $(dir $@)
$(CC) -c -o $@ $< $(CC_FLAGS)
compile_commands.json:
compiledb -n make