2023-12-14 23:08:16 +00:00
|
|
|
BIN = bin
|
|
|
|
OUT = $(BIN)/out
|
2023-12-15 00:38:55 +00:00
|
|
|
INS = /usr/local/bin/nbtvis
|
2023-12-14 23:08:16 +00:00
|
|
|
|
2023-12-17 16:10:04 +00:00
|
|
|
SRC = $(shell find src -type f -name "*.c")
|
|
|
|
SRC += $(shell find lib -type f -name "*.c")
|
|
|
|
SRC += $(shell find nbt -type f -name "*.c")
|
2023-12-14 23:08:16 +00:00
|
|
|
OBJ = $(patsubst %.c,$(BIN)/%.o, $(SRC))
|
|
|
|
|
2023-12-17 16:10:04 +00:00
|
|
|
CCFLAGS = -Isrc -Ilib -Inbt -std=c2x -Wall -Wextra -pedantic -O0 -g
|
2023-12-14 23:08:16 +00:00
|
|
|
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)
|
|
|
|
|
2023-12-15 00:38:55 +00:00
|
|
|
run:
|
|
|
|
$(OUT)
|
|
|
|
|
|
|
|
install:
|
|
|
|
cp $(OUT) $(INS)
|
|
|
|
chown root: $(INS)
|
|
|
|
|
2023-12-14 23:08:16 +00:00
|
|
|
clean:
|
|
|
|
rm -fr $(BIN)
|