nesemu/Makefile

31 lines
405 B
Makefile
Raw Normal View History

2023-09-21 23:53:14 -04:00
CC = gcc
BIN = ./bin
OBJ = ./obj
SRC = ./src
SRCS = $(wildcard $(SRC)/*.c)
OBJS = $(patsubst $(SRC)/%.c,$(OBJ)/%.o,$(SRCS))
EXE = $(BIN)/emu
CFLAGS = -Wall
LDLIBS = -lm
.PHONY: all run clean
all: $(EXE)
$(EXE): $(OBJS) | $(BIN)
$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ)
$(CC) $(CFLAGS) -c $< -o $@
$(BIN) $(OBJ):
mkdir $@
run: $(EXE)
$<
clean:
rm -rf $(OBJ) $(BIN)