-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·57 lines (42 loc) · 1.11 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
# makefile for primordial graphical framework
# have this compile linux or windows
# use os=linux/windows on make command
# --- Config ---
flags = -Wall -O2
# --- OS Dependent ---
ifeq ($(os),linux)
cc = g++
name = pgf
links = -lglfw3 -lGL -lX11 -lpthread -lXrandr -lXi -ldl# -lm
clean_shaders = rm -f bin/linux/shaders/*
copy_shaders = cp shaders/* bin/linux/shaders/
else ifeq ($(os),windows)
cc = x86_64-w64-mingw32-g++.exe
name = pgf.exe
links = -lglfw3
clean_shaders = del /q bin\windows\shaders\*
copy_shaders = xcopy shaders bin\windows\shaders
else
$(error invalid os name)
endif
# --- Paths ---
source_path = src
include_path = include
library_path = lib/$(os)
object_path = obj/$(os)
output_path = bin/$(os)
raw_sources = main.cpp glad.c
sources = $(addprefix $(source_path)/, $(raw_sources))
output = $(output_path)/$(name)
# --- Recipes ---
all: shaders
@echo Building pgf for $(os)...
$(cc) $(flags) $(sources) -o $(output) -I$(include_path) -L$(library_path) $(links)
.PHONY: shaders
shaders:
$(clean_shaders)
$(copy_shaders)
.PHONY: clean
clean:
@echo cleaning up...
del /S *.o