-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (31 loc) · 812 Bytes
/
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
#File Directory things (might be overkill idk yet)
INCLUDE = -I$(SRC_DIR)/headers
SRC_DIR = ./src
OBJ_DIR = ./obj
LOG_DIR = ./logs
#Compiler and linker things
CC = g++
CCFLAGS = -g -Wall -Wextra -DDBG
LD = ld
LDFLAGS =
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
#Essential files and groups
OBJ = Gif2Ascii
SRCS = $(call rwildcard, $(SRC_DIR), *.cpp)
OBJS = $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRCS))
all: $(OBJ)
@mkdir -p $(LOG_DIR)
@mkdir -p $(@D)
@echo ---- Generating $^ ---
$(OBJ): $(OBJS)
@echo ---- Linking $^ ----
@mkdir -p $(@D)
$(CC) $^ -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@echo ---- Compiling $^ ----
@mkdir -p $(@D)
$(CC) $(CCFLAGS) $(INCLUDE) -c $< -o $@
clean:
rm $(OBJ)
rm -rf $(OBJ_DIR)/
rm -rf $(LOG_DIR)/