summaryrefslogtreecommitdiff
path: root/Makefile
blob: 495d87de56722641f14f9514151df31dab9bbeed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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: dirs run clean build install uninstall

EOF: 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