2023-04-10 22:55:54 +00:00
|
|
|
NAME:=lat
|
2023-04-09 17:42:44 +00:00
|
|
|
|
2023-04-10 22:55:54 +00:00
|
|
|
SRCDIR:=src
|
|
|
|
IDIR:=include
|
|
|
|
ODIR:=obj
|
|
|
|
BINDIR:=build
|
2023-04-09 17:42:44 +00:00
|
|
|
|
2023-04-10 22:55:54 +00:00
|
|
|
CC:=cc
|
2023-04-12 18:33:29 +00:00
|
|
|
CFLAGS:=-I$(IDIR) -Wall -Wextra -pedantic -Ofast
|
2023-04-10 22:55:54 +00:00
|
|
|
LIB:=
|
2023-04-09 17:42:44 +00:00
|
|
|
|
2023-04-10 22:55:54 +00:00
|
|
|
DEPS:=$($(IDIR)/%.h)
|
2023-04-09 17:42:44 +00:00
|
|
|
|
2023-04-10 22:55:54 +00:00
|
|
|
SRCS=$(shell find . -name "*.c")
|
2023-04-10 23:09:11 +00:00
|
|
|
BASENAME:=$(shell basename -a $(SRCS))
|
2023-04-09 17:42:44 +00:00
|
|
|
|
2023-04-10 22:55:54 +00:00
|
|
|
VPATH=$(dir $(SRCS))
|
2023-04-09 17:42:44 +00:00
|
|
|
|
2023-04-10 22:55:54 +00:00
|
|
|
OBJ=$(patsubst %.c,./$(ODIR)/%.o,$(BASENAME))
|
|
|
|
|
|
|
|
$(ODIR)/%.o: %.c $(DEPS)
|
2023-04-09 17:42:44 +00:00
|
|
|
$(CC) -c -o $@ $< $(CFLAGS) $(LIB)
|
|
|
|
|
|
|
|
$(NAME): $(OBJ)
|
|
|
|
$(CC) -o $(BINDIR)/$@ $^ $(CFLAGS) $(LIB)
|
|
|
|
|
|
|
|
.PHONY: prep
|
|
|
|
prep:
|
|
|
|
-@mkdir -p $(SRCDIR)
|
|
|
|
-@mkdir -p $(IDIR)
|
|
|
|
-@mkdir -p $(ODIR)
|
|
|
|
-@mkdir -p $(BINDIR)
|
|
|
|
@echo $(BINDIR)/ >> .gitignore
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
-rm -f $(ODIR)/*
|
|
|
|
-rm -f $(BINDIR)/*
|