aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 879e5e66ca34ffca62d2ede0be4d11fe2deaedd9 (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
CC=tcc
CFLAGS=-g -O2 -lncurses -ltinfo
SRC=src
OBJ=obj
SOURCES=$(wildcard $(SRC)/*.c)
OBJECTS=$(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES))
BIN=main


run: $(BIN)
	./$(BIN)

build: $(BIN)

$(BIN): $(OBJECTS)
	$(CC) $(CFLAGS) $(OBJECTS) -o $(BIN)

$(OBJ)/$(BIN).o: $(SRC)/$(BIN).c $(OBJ)
	$(CC) -c $< -o $@

$(OBJ)/%.o: $(SRC)/%.c $(SRC)/%.h $(OBJ)
	$(CC) -c $< -o $@

$(OBJ):
	mkdir -p $(OBJ)

clean:
	rm -r $(BIN) $(OBJ)/*.o