forked from firizky29/mobita-CLI-game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
86 lines (62 loc) · 2.34 KB
/
Makefile
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
CC = gcc
BUILD_DIR := ./build
BIN_DIR := ./bin
SRC_DIR := ./src
TEST_DIR := ./test
TARGET := $(BIN_DIR)/MobitaGame
CFLAG = -Wall -std=c99
BUILD_FLAG = -lm
SRCS := $(shell find src -name *.c ! -name "main.c" ! -name "driver_*.c")
OBJS := $(patsubst %.c,$(BUILD_DIR)/%.o,$(SRCS))
INC_DIR := $(wildcard src/*/**/**)
INC_FLAG := $(addprefix -I,$(INC_DIR)) -Isrc/lib
$(BUILD_DIR)/src/%.o $(BUILD_DIR)/%.o: ./src/%.c
@mkdir -p $(dir $@)
@$(CC) -g $(CFLAG) $(INC_FLAG) -c $< -o $@
$(TARGET): $(OBJS) $(BUILD_DIR)/main.o
@mkdir -p bin
@$(CC) $(INC_FLAG) $^ -o $@ -O3
build: $(OBJS) $(BUILD_DIR)/main.o
@mkdir -p bin
@$(CC) -g $(INC_FLAG) $^ -o $(TARGET)
run: build
@$(TARGET)
clear:
@rm -rf build/* bin/* test/*
all : clear build
.PHONY : clear all build run
# ADT RUNNER
machine: $(SRCS) ./src/lib/tools/mesin-kata/driver_machine.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/machine
pcolor: $(SRCS) ./src/lib/tools/pcolor/driver_pcolor.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/pcolor
stack: $(SRCS) ./src/lib/data-structure/stack/driver_stack.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/stack
queue: $(SRCS) ./src/lib/data-structure/queue/driver_queue.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/queue
point: $(SRCS) ./src/lib/data-structure/point/driver_point.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/point
pesanan: $(SRCS) ./src/lib/data-structure/pesanan/driver_pesanan.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/pesanan
matrix: $(SRCS) ./src/lib/data-structure/matriks/driver_matrix.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/matriks
liststat: $(SRCS) ./src/lib/data-structure/list-statis/driver_liststat.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/liststat
listlinked: $(SRCS) ./src/lib/data-structure/list-linked/driver_list_linked.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/listlinked
listdin: $(SRCS) ./src/lib/data-structure/list-dinamis/driver_listdin.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/listdin
peta: $(SRCS) ./src/lib/scene/peta/driver_peta.c
@mkdir -p test
@$(CC) -g $(CFLAG) $(INC_FLAG) $^ -o $(TEST_DIR)/peta
ADT_BUILDER: machine listlinked listdin liststat pesanan peta matrix point pcolor queue stack