This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (50 loc) · 1.4 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
CC = g++
#SPACE RECOGNITION
null :=
space := ${null} ${null}
${space} := ${space} # ${ } is a space. Neat huh?
#END OFSPACE RECOGNITION
EXEC_NAME = $(notdir $(subst ${ },_,$(shell pwd)) )
RMV = rm -f src/*.o
ifneq ($(wildcard /usr/include/GLFW),)
DIR_PREFIX = /usr
else
DIR_PREFIX = /usr/local
endif
CCFLAGS += -D LINUX
ifeq ($(OS),Windows_NT)
#WINDOWS BUILD OPTIONS
ifneq ($(wildcard C:/include/SFML),)
DIR_PREFIX = /usr
else
DIR_PREFIX = /usr/local
endif
RMV = cmd //C del *.o
EXEC_NAME = $(notdir $(subst ${ },_,$(shell cd)) ).exe
endif
DLIBS = $(DIR_PREFIX)/lib/
GL_INCLUDE_DIR = $(DIR_PREFIX)/include/GLFW
GLFLAGS = -lpthread -lglfw -lGL -lX11 -lXrandr -lXi -ldl
CFLAGS = $(GLFLAGS) -I$(GL_INCLUDE_DIR) -Wall -O0
EXEC_NAME = AngelinoEngine # Fix, placeholder name until i find a way to handle spaces
.PHONY : all clean # Target that arent a file
all : $(EXEC_NAME) clean
SRC = $(wildcard src/*.cpp)
OBJ = $(SRC:.cpp=.o) # Considera i file .cpp ma che che hanno come suffisso .o
$(EXEC_NAME) : $(OBJ) src/glad.o
@echo "** Building main executable, aka $(EXEC_NAME) ..."
$(CC) -L$(DLIBS) -o $@ $(OBJ) src/glad.o $(CFLAGS)
%.o: %.cpp src/glad.c
@echo "** Building obj files..."
$(CC) -c $< -o $@
bnr :
@echo "** Build start"
make
@echo "** Excecuting.."
./$(EXEC_NAME)
clean :
@echo "** Removing object files..."
$(RMV)
clean_all :
@echo "** Removing all generated files..."
$(RMV) $(EXEC_NAME)