31 lines
405 B
Makefile
31 lines
405 B
Makefile
|
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)
|