40 lines
568 B
Makefile
40 lines
568 B
Makefile
|
CC = gcc
|
||
|
|
||
|
INCFLAGS = -Isrc
|
||
|
|
||
|
CCFLAGS = -std=c99 -Wall -Wextra -pedantic -O2
|
||
|
CCFLAGS += $(INCFLAGS)
|
||
|
|
||
|
LDFLAGS += $(INCFLAGS)
|
||
|
LDFLAGS += -lpthread
|
||
|
|
||
|
BIN = bin
|
||
|
APP = $(BIN)/app
|
||
|
SRC = $(shell find src -name "*.c")
|
||
|
OBJ = $(SRC:%.c=$(BIN)/%.o)
|
||
|
|
||
|
.PHONY: clean build
|
||
|
|
||
|
dirs:
|
||
|
mkdir -p ./$(BIN)
|
||
|
mkdir -p ./$(BIN)/src
|
||
|
|
||
|
run: build
|
||
|
$(APP)
|
||
|
|
||
|
build: dirs ${OBJ}
|
||
|
${CC} -o $(APP) $(filter %.o,$^) $(LDFLAGS)
|
||
|
|
||
|
$(BIN)/%.o: %.c
|
||
|
$(CC) -o $@ -c $< $(CCFLAGS)
|
||
|
|
||
|
clean:
|
||
|
rm -rf $(APP)
|
||
|
rm -rf $(BIN)
|
||
|
|
||
|
install:
|
||
|
cp $(APP) /usr/local/bin/brainfucked
|
||
|
|
||
|
uninstall:
|
||
|
rm /usr/local/bin/brainfucked
|