Update Makefile

This commit is contained in:
Shav Kinderlehrer 2023-04-10 18:55:54 -04:00
parent d3526c4e13
commit 89b97deeff

View File

@ -1,22 +1,25 @@
NAME=main NAME:=lat
SRCDIR=src SRCDIR:=src
IDIR=include IDIR:=include
ODIR=obj ODIR:=obj
BINDIR=build BINDIR:=build
CC=cc CC:=cc
CFLAGS=-I$(IDIR) -Wall -Wextra -pedantic CFLAGS:=-I$(IDIR) -Wall -Wextra -pedantic
LIB= LIB:=
_DEPS=lib.h DEPS:=$($(IDIR)/%.h)
DEPS=$(patsubst %,$(IDIR)/%,$(_DEPS))
_OBJ=$(NAME).o lib.o #SRCS:=$(wildcard $(SRCDIR)/*.c)
OBJ=$(patsubst %,$(ODIR)/%,$(_OBJ)) SRCS=$(shell find . -name "*.c")
BASENAME:=$(shell basename $(SRCS))
VPATH=$(dir $(SRCS))
$(ODIR)/%.o: $(SRCDIR)/%.c $(DEPS) OBJ=$(patsubst %.c,./$(ODIR)/%.o,$(BASENAME))
$(ODIR)/%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(LIB) $(CC) -c -o $@ $< $(CFLAGS) $(LIB)
$(NAME): $(OBJ) $(NAME): $(OBJ)