lat/Makefile

37 lines
548 B
Makefile
Raw Normal View History

2023-04-09 17:42:44 +00:00
NAME=main
SRCDIR=src
IDIR=include
ODIR=obj
BINDIR=build
CC=cc
CFLAGS=-I$(IDIR) -Wall -Wextra -pedantic
LIB=
2023-04-10 04:58:48 +00:00
_DEPS=lib.h
2023-04-09 17:42:44 +00:00
DEPS=$(patsubst %,$(IDIR)/%,$(_DEPS))
2023-04-10 04:58:48 +00:00
_OBJ=$(NAME).o lib.o
2023-04-09 17:42:44 +00:00
OBJ=$(patsubst %,$(ODIR)/%,$(_OBJ))
$(ODIR)/%.o: $(SRCDIR)/%.c $(DEPS)
$(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)/*