mips/makefile.mk

33 lines
568 B
Makefile
Raw Normal View History

# needed cflags
CFLAGS += -std=c2x
# add include directory
CFLAGS += -isystem ../include
INCLUDE += ../include
# add lib directory
SRC += ../lib
H_SRC = $(shell find $(SRC) $(INCLUDE) -type f -name "*.h")
C_SRC = $(shell find $(SRC) -type f -name "*.c")
C_OBJ = $(patsubst %.c,$(BIN)/%.o,$(C_SRC))
.PHONY: clean build run
build: $(BIN)/$(OUT)
clean:
rm -fr $(BIN)
run: build
$(BIN)/$(OUT)
$(C_OBJ): $(BIN)/%.o : %.c
@mkdir -p $(@D)
$(CC) -c $(CFLAGS) -o $@ $<
$(BIN)/$(OUT): $(C_OBJ) $(H_SRC)
@mkdir -p $(@D)
$(LD) $(LDFLAGS) -o $(BIN)/$(OUT) $(C_OBJ)