-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
38 lines (32 loc) · 1.06 KB
/
makefile
File metadata and controls
38 lines (32 loc) · 1.06 KB
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
# new makefile
# old makefile was contributed to by servusDei2018 and hamzainaan
CC = gcc
CFLAGS = -O3 -s -Wall -flto
#CFLAGS = -O3 -g -pg -no-pie # use these compile flags if profiling with gprof
CFLAGS = -O3 -s -Wall -fopenmp -flto # use these compile flags if tuning eval and have ability to use OpenMP
LDFLAGS = -lm
VERSION = CeeChess-v2.2
# windows requires backslash
ifeq ($(OS),Windows_NT)
RM = del /Q
EXE_EXTENSION = .exe
SRC_DIR = .\src
BIN_DIR = .\bin
TARGET = $(BIN_DIR)\$(VERSION)
else
RM = rm -rf
EXE_EXTENSION = -linux
CFLAGS += -D LINUX
SRC_DIR = ./src
BIN_DIR = ./bin
TARGET = $(BIN_DIR)/$(VERSION)
endif
# Automatically discover all source and header files in the ./src directory
SRC_FILES := $(wildcard $(SRC_DIR)/*.c)
HEADER_FILES := $(wildcard $(SRC_DIR)/*.h)
all: $(TARGET)$(EXE_EXTENSION)
$(TARGET)$(EXE_EXTENSION): $(SRC_FILES) $(HEADER_FILES)
$(CC) $^ -o $@ $(CFLAGS) $(LDFLAGS)
# clean the object files and the binary (don't need to clean object files anymore)
clean:
-$(RM) $(TARGET)$(EXE_EXTENSION)