18 lines
467 B
Makefile
18 lines
467 B
Makefile
|
CC :=gcc
|
||
|
AR := ar
|
||
|
CFLAGS := -Wall -g -c
|
||
|
|
||
|
target := libtlang.a
|
||
|
tlang_c_source_files := $(shell find src/ -name *.c)
|
||
|
tlang_c_object_files := $(patsubst src/%.c, build/%.o, $(tlang_c_source_files))
|
||
|
|
||
|
|
||
|
$(target): $(tlang_c_object_files)
|
||
|
$(AR) -rcs $(target) $(tlang_c_object_files)
|
||
|
|
||
|
$(tlang_c_object_files): build/%.o : src/%.c
|
||
|
mkdir -p $(dir $@) && \
|
||
|
$(CC) $(CFLAGS) -I include $(patsubst build/%.o, src/%.c, $@) -o $@
|
||
|
.PHONY: clean
|
||
|
clean:
|
||
|
rm -rf build; rm $(target)
|