36 lines
598 B
Makefile
36 lines
598 B
Makefile
BIN = bin
|
|
OUT = $(BIN)/out
|
|
INS = /usr/local/bin/nbtvis
|
|
|
|
SRC = $(shell find src -type f -name "*.c")
|
|
SRC += $(shell find lib -type f -name "*.c")
|
|
SRC += $(shell find nbt -type f -name "*.c")
|
|
OBJ = $(patsubst %.c,$(BIN)/%.o, $(SRC))
|
|
|
|
CCFLAGS = -Isrc -Ilib -Inbt -std=c2x -Wall -Wextra -pedantic -O0 -g
|
|
LDFLAGS =
|
|
|
|
CC = gcc
|
|
LD = gcc
|
|
|
|
.PHONY: build
|
|
|
|
build: $(OUT)
|
|
|
|
$(OBJ): $(BIN)/%.o : %.c
|
|
@mkdir -p $(@D)
|
|
$(CC) -c $(CCFLAGS) -o $@ $<
|
|
|
|
$(OUT): $(OBJ) $(ASM_OBJ)
|
|
@mkdir -p $(@D)
|
|
$(LD) -o $(OUT) $(OBJ) $(LDFLAGS)
|
|
|
|
run:
|
|
$(OUT)
|
|
|
|
install:
|
|
cp $(OUT) $(INS)
|
|
chown root: $(INS)
|
|
|
|
clean:
|
|
rm -fr $(BIN)
|