-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (41 loc) · 1.1 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
# Alternative to CMAKE
# Check OS in order to use the appropriate compiler
ifeq ($(OS),Windows_NT)
COMPILER=x86_64-w64-mingw32-g++
TARGET=niyebe.exe
else
COMPILER=g++
TARGET=niyebe
endif
# Directories
SRC-DIR = src/
INCLUDE-DIR = include/
# Flags
i-flag = -I include
static-flag = -static -static-libstdc++ -static-libgcc
# Source
sources = main.cpp
objects = main.o niyebe.o
# Rules & Recipes
$(TARGET): $(objects)
@$(COMPILER) $(static-flag) -o $(TARGET) $(objects)
@echo "$(COMPILER) $< --> $@"
main.o: $(SRC-DIR)main.cpp $(INCLUDE-DIR)NiyebeConfig.h
@$(COMPILER) $(static-flag) $(i-flag) -c $(SRC-DIR)main.cpp
@echo "$(COMPILER) $< --> $@"
niyebe.o: $(SRC-DIR)niyebe.cpp
@$(COMPILER) $(static-flag) $(i-flag) -c $(SRC-DIR)niyebe.cpp
@echo "$(COMPILER) $< --> $@"
install:
ifneq (,$(wildcard ./niyebe))
@rm -rf /opt/Niyebe
@mkdir /opt/Niyebe
@cp niyebe /opt/Niyebe
@echo "Successfully installed niyebe in /opt/Niyebe."
else
@echo "INSTALL ERROR: Source code not yet compiled.\n"
@echo "Suggested fix: Run 'make' to compile."
endif
clean:
@rm -f *.o $(TARGET)
@echo "Removed *.o *.exe files"