calculator/Makefile

41 lines
679 B
Makefile
Raw Permalink Normal View History

2021-07-01 17:04:13 +02:00
CC=gcc
CFLAGS=-Wall -O3 -march=native -std=c99
LDFLAGS=
EXE=str_eval
ODIR=obj
LIBS=-lm
DEPS=lex.h ast.h token.h token_list.h ptr_stack.h error.h
_OBJ=lex.c ast.c token.c token_list.c ptr_stack.c error.c main.c
OBJ=$(patsubst %.c,$(ODIR)/%.o,$(_OBJ))
all: makedepend odir $(EXE)
run: all
./$(EXE)
$(ODIR)/%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(LIBS)
$(EXE): $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) $(LDFLAGS)
makedepend: $(_OBJ) $(DEPS)
echo "# Automatically generated by makedepend" > $@
makedepend -Y -f $@ -p $(ODIR)/ $(_OBJ) 2>/dev/null
rm $@.bak
odir:
mkdir -p $(ODIR)
.PHONY: clean makedepend
clean:
rm -rf $(ODIR) $(EXE) makedepend
include makedepend