lat/Makefile

40 lines
629 B
Makefile
Raw Normal View History

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
CFLAGS:=-I$(IDIR) -Wall -Wextra -pedantic
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:=$(wildcard $(SRCDIR)/*.c)
SRCS=$(shell find . -name "*.c")
BASENAME:=$(shell basename $(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)/*