forked from kruegz/cchess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (40 loc) · 1.03 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
TARGET = cchess
CC = gcc
# Use gcc compiler
CFLAGS = -Wall -Werror -Isrc/include
# -Wall : Show all errors
# -Werror : Make warnings errors
DEBUGFLAGS = -g -DDEBUG
# -g : Include debugging information
# -DDEBUG : #define DEBUG
RELEASEFLAGS = -O3
# -O3 : Highest level optimization
LINKER = gcc -o
LFLAGS = -Wall -I. -lm
SRCDIR = src
INCLUDEDIR = src/include
OBJDIR = obj
BINDIR = bin
SOURCES := $(wildcard $(SRCDIR)/*.c)
INCLUDES := $(wildcard $(INCLUDEDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
rm = rm -f
all: release
echo Compiling $(CLION_EXE_DIR)/$@ ...
debug: CFLAGS += $(DEBUGFLAGS)
debug: $(BINDIR)/$(TARGET)
release: CFLAGS += $(RELEASEFLAGS)
release: $(BINDIR)/$(TARGET)
$(BINDIR)/$(TARGET): $(OBJECTS)
mkdir -p bin
$(LINKER) $@ $(LFLAGS) $(OBJECTS)
#$(LINKER) $(CLION_EXE_DIR)/cchess $(LFLAGS) $(OBJECTS)
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
mkdir -p obj
$(CC) $(CFLAGS) -c $< -o $@
.PHONEY: clean
clean:
$(rm) $(OBJECTS)
.PHONEY: remove
remove: clean
$(rm) $(BINDIR)/$(TARGET)