updated to newest version that i've used
This commit is contained in:
parent
87dbdca122
commit
0f493229bc
61
makefile
61
makefile
@ -1,69 +1,70 @@
|
|||||||
#Copyright 2018 Rexy712 of Rexy & Co
|
|
||||||
#This program is free software: you can redistribute it and/or modify
|
#This program is free software: you can redistribute it and/or modify
|
||||||
#it under the terms of the GNU General Public License as published by
|
#it under the terms of the GNU General Public License as published by
|
||||||
#the Free Software Foundation, either version 3 of the License, or
|
#the Free Software Foundation, either version 3 of the License, or
|
||||||
#(at your option) any later version.
|
#(at your option) any later version.
|
||||||
#
|
|
||||||
#This program is distributed in the hope that it will be useful,
|
#This program is distributed in the hope that it will be useful,
|
||||||
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
#GNU General Public License for more details.
|
#GNU General Public License for more details.
|
||||||
#
|
|
||||||
#You should have received a copy of the GNU General Public License
|
#You should have received a copy of the GNU General Public License
|
||||||
#along with this program. If not, see <https://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#Copyright 2018 rexy712
|
||||||
|
|
||||||
#Makefile for project
|
|
||||||
|
|
||||||
#Project directory and file setup
|
|
||||||
SOURCE_DIRS:=src
|
SOURCE_DIRS:=src
|
||||||
OBJDIR:=obj
|
OBJDIR:=obj
|
||||||
DEPDIR:=obj/dep
|
DEPDIR:=$(OBJDIR)/dep
|
||||||
INCLUDE_DIRS:=include
|
INCLUDE_DIRS:=include
|
||||||
EXT:=c
|
EXT:=cpp
|
||||||
MAIN_EXECUTABLE:=rex-edid
|
MAIN_EXECUTABLE:=tester
|
||||||
|
|
||||||
#Compiler/Linker setup
|
CXX:=g++
|
||||||
CC:=gcc
|
CXXFLAGS:=-g -std=c++17 -Wall -pedantic -Wextra
|
||||||
CFLAGS:=-x c -g -std=c11 -Wall -pedantic -Wextra
|
all: CXXFLAGS+=-O0
|
||||||
release: CFLAGS+=-O2
|
release: CXXFLAGS+=-O2
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
LDLIBS:=-lxcb -lxcb-randr
|
LDLIBS:=
|
||||||
STRIP:=strip
|
STRIP:=strip
|
||||||
|
|
||||||
#Windows workarounds
|
memchk:LDFLAGS+=-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
||||||
|
memchk:CXXFLAGS+=-O0 -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
mkdir=mkdir $(subst /,\,$(1)) > NUL 2>&1
|
mkdir=mkdir $(subst /,\,$(1)) > NUL 2>&1
|
||||||
rm=del /F $(1) > NUL 2>&1
|
rm=del /F $(1) > NUL 2>&1
|
||||||
rmdir=rd /s /q $(1) > NUL 2>&1
|
rmdir=rd /s /q $(1) > NUL 2>&1
|
||||||
move=move /y $(subst /,\,$(1)) $(subst /,\,$(2)) > NUL 2>&1
|
move=move /y $(subst /,\,$(1)) $(subst /,\,$(2)) > NUL 2>&1
|
||||||
MAIN_EXECUTABLE:=$(MAIN_EXECUTABLE).exe
|
MAIN_EXECUTABLE:=$(MAIN_EXECUTABLE).exe
|
||||||
LDLIBS:=
|
LDLIBS:=-lglfw3 -lSOIL -lgl3w -lm -lopengl32 -lglu32 -lgdi32 -lkernel32
|
||||||
else
|
else
|
||||||
mkdir=mkdir -p $(1)
|
mkdir=mkdir -p $(1)
|
||||||
rm=rm -f $(1)
|
rm=rm -f $(1)
|
||||||
rmdir=rm -rf $(1)
|
rmdir=rm -rf $(1)
|
||||||
move=mv $(1) $(2)
|
move=mv $(1) $(2)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#Internal management of sources/objects and additional cflags
|
INTERNAL_CXXFLAGS=-c $(foreach dir,$(INCLUDE_DIRS),-I"$(dir)") -MMD -MP -MF"$(DEPDIR)/$(notdir $(patsubst %.o,%.d,$@))"
|
||||||
INTERNAL_CFLAGS=-c $(foreach dir,$(INCLUDE_DIRS),-I"$(dir)") -MMD -MP -MF"$(DEPDIR)/$(notdir $(subst .o,.d,$@))"
|
|
||||||
SOURCES:=$(foreach source,$(SOURCE_DIRS),$(foreach ext,$(EXT),$(wildcard $(source)/*.$(ext))))
|
SOURCES:=$(foreach source,$(SOURCE_DIRS),$(foreach ext,$(EXT),$(wildcard $(source)/*.$(ext))))
|
||||||
OBJECTS:=$(addprefix $(OBJDIR)/,$(subst \,.,$(subst /,.,$(addsuffix .o,$(SOURCES)))))
|
OBJECTS:=$(addprefix $(OBJDIR)/,$(subst \,.,$(subst /,.,$(addsuffix .o,$(SOURCES)))))
|
||||||
|
|
||||||
all: $(MAIN_EXECUTABLE)
|
all: $(MAIN_EXECUTABLE)
|
||||||
|
memchk: $(MAIN_EXECUTABLE)
|
||||||
|
|
||||||
$(MAIN_EXECUTABLE): $(OBJECTS)
|
$(MAIN_EXECUTABLE): $(OBJECTS)
|
||||||
$(CC) $(LDFLAGS) $^ -o "$(basename $@)" $(LDLIBS)
|
$(CXX) $(LDFLAGS) $^ -o "$(basename $@)" $(LDLIBS)
|
||||||
|
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
release: $(OBJECTS)
|
release: $(OBJECTS)
|
||||||
$(CC) $(LDFLAGS) $^ -o "$(basename $(MAIN_EXECUTABLE))" $(LDLIBS)
|
$(CXX) $(LDFLAGS) $^ -o "$(basename $(MAIN_EXECUTABLE))" $(LDLIBS)
|
||||||
$(STRIP) --strip-all "$(MAIN_EXECUTABLE)"
|
$(STRIP) --strip-all "$(MAIN_EXECUTABLE)"
|
||||||
|
|
||||||
define GENERATE_OBJECTS
|
define GENERATE_OBJECTS
|
||||||
|
|
||||||
$$(OBJDIR)/$(subst \,.,$(subst /,.,$(1))).%.o: $(1)/%
|
$$(OBJDIR)/$(subst \,.,$(subst /,.,$(1))).%.o: $(1)/%
|
||||||
$$(CC) $$(CFLAGS) $$(INTERNAL_CFLAGS) "$$<" -o "$$@"
|
$$(CXX) $$(CXXFLAGS) $$(INTERNAL_CXXFLAGS) "$$<" -o "$$@"
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user