Split project into smaller Makefiles
Instead of controlling all logic from the top-level Makefile, splitting into directory-specific Makefiles allows for: - Better separation of concerns - Improved compatibility with POSIX make(1) As a possible drawback, support for out-of-tree builds has been removed, in favour of simplicity and POSIX compatibility.
This commit is contained in:
parent
a01a0da03d
commit
1122308c15
|
@ -0,0 +1,20 @@
|
|||
.POSIX:
|
||||
.SUFFIXES: .svg .png .bmp
|
||||
|
||||
DEPS = \
|
||||
Botan_Map.png \
|
||||
Botan_Map_Old.png \
|
||||
Botan_Map_Old_2.png \
|
||||
World_Map.png \
|
||||
Controller.png \
|
||||
QWERTY_keyboard_diagram.png \
|
||||
Regular_truncation_10_1000.png \
|
||||
upload.wikimedia.org_wikipedia_commons_3_3f_Placeholder_view_vector.png
|
||||
|
||||
all: $(DEPS)
|
||||
|
||||
clean:
|
||||
rm -f $(DEPS)
|
||||
|
||||
.svg.png .bmp.png:
|
||||
convert $< $@
|
|
@ -0,0 +1,47 @@
|
|||
# This file is part of LibreWands.
|
||||
# LibreWands is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# LibreWands is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with LibreWands. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
.POSIX:
|
||||
|
||||
PROJECT = LibreWands.pdf
|
||||
DEPS = \
|
||||
LibreWands.tex \
|
||||
Articles/Acquiring.tex \
|
||||
Articles/ConceptArt.tex \
|
||||
Articles/Controls.tex \
|
||||
Articles/Credits.tex \
|
||||
Articles/EngineDesign.tex \
|
||||
Articles/GameDesign.tex \
|
||||
Articles/GameplayIntroduction.tex \
|
||||
Articles/Introduction.tex \
|
||||
Articles/ItemEncyclopedia.tex \
|
||||
Articles/MapEditing.tex \
|
||||
Articles/MonsterEncyclopedia.tex \
|
||||
Articles/MoveEncyclopedia.tex \
|
||||
Articles/PackagingGuide.tex \
|
||||
Articles/Support.tex \
|
||||
Articles/WorkTimeline.tex \
|
||||
Articles/WorldEncyclopedia.tex \
|
||||
|
||||
all: $(PROJECT)
|
||||
|
||||
install: $(PROJECT)
|
||||
mkdir -p $(PREFIX)/doc
|
||||
cp $(PROJECT) $(PREFIX)/doc
|
||||
|
||||
clean:
|
||||
rm -f $(PROJECT)
|
||||
|
||||
$(PROJECT): $(DEPS)
|
||||
pdflatex LibreWands.tex
|
72
Makefile
72
Makefile
|
@ -12,69 +12,35 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with LibreWands. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
version = 0.0.3
|
||||
.POSIX:
|
||||
|
||||
PREFIX = /usr/local/
|
||||
BUILDDIR = Build/
|
||||
ARTDIR = $(BUILDDIR)/Art
|
||||
|
||||
all: editMaps
|
||||
|
||||
install: editMaps
|
||||
mkdir -p $(DESTDIR)/usr/
|
||||
mkdir -p $(DESTDIR)/usr/games/
|
||||
cp Build/librewands_editmaps $(DESTDIR)/usr/games/librewands_editmaps
|
||||
|
||||
install:
|
||||
+cd Source/ && $(MAKE) install PREFIX=$(PREFIX)
|
||||
+cd Documentation/ && $(MAKE) install PREFIX=$(PREFIX)
|
||||
|
||||
install-pdf:
|
||||
mkdir -p $(DESTDIR)/usr/
|
||||
mkdir -p $(DESTDIR)/usr/share/
|
||||
mkdir -p $(DESTDIR)/usr/share/doc/
|
||||
mkdir -p $(DESTDIR)/usr/share/doc/librewands/
|
||||
cp Build/LibreWands.pdf $(DESTDIR)/usr/share/doc/librewands/
|
||||
assets:
|
||||
+cd Assets/Art/ && $(MAKE) BUILDDIR=$(BUILDDIR)/Art
|
||||
|
||||
uninstall:
|
||||
rm $(DESTDIR)/usr/games/librewands_editmaps
|
||||
|
||||
uninstall-pdf:
|
||||
rm -r $(DESTDIR)/usr/share/doc/librewands/
|
||||
|
||||
pdf:
|
||||
cd Build/;mkdir -p "Art"
|
||||
convert "./Assets/Art/Botan_Map.svg" "Build/Art/Botan Map.png"
|
||||
convert "./Assets/Art/Botan_Map_Old.svg" "Build/Art/Botan Map Old.png"
|
||||
convert "./Assets/Art/Botan_Map_Old_2.bmp" "Build/Art/Botan Map Old 2.png"
|
||||
convert "./Assets/Art/World_Map.svg" "Build/Art/World Map.png"
|
||||
convert "./Assets/Art/Controller.svg" "Build/Art/Controller.png"
|
||||
convert "./Assets/Art/commons.wikimedia.org_wiki_File:QWERTY_keyboard_diagram.svg" "Build/Art/commons.wikimedia.org_wiki_File:QWERTY_keyboard_diagram.png"
|
||||
convert "./Assets/Art/commons.wikimedia.org_wiki_File:Regular_truncation_10_1000.svg" "Build/Art/commons.wikimedia.org_wiki_File:Regular_truncation_10_1000.png"
|
||||
convert "./Assets/Art/upload.wikimedia.org_wikipedia_commons_3_3f_Placeholder_view_vector.svg" "Build/Art/upload.wikimedia.org_wikipedia_commons_3_3f_Placeholder_view_vector.png"
|
||||
cd Build/;pdflatex ../Documentation/LibreWands.tex
|
||||
|
||||
clean:
|
||||
mkdir -p Build/
|
||||
rm -r Build/*
|
||||
|
||||
dist:
|
||||
mkdir -p "Build/librewands-$(version)"
|
||||
cp -r "Assets/" "Build/librewands-$(version)"
|
||||
cp -r "Documentation/" "Build/librewands-$(version)"
|
||||
cp -r "Packaging/" "Build/librewands-$(version)"
|
||||
cp -r "Source/" "Build/librewands-$(version)"
|
||||
cp -r "Tests/" "Build/librewands-$(version)"
|
||||
cp -r "Tools/" "Build/librewands-$(version)"
|
||||
cp "_clang-format" "Build/librewands-$(version)"
|
||||
cp "LICENSE" "Build/librewands-$(version)"
|
||||
cp "Makefile" "Build/librewands-$(version)"
|
||||
cp "README.md" "Build/librewands-$(version)"
|
||||
cd Build/;tar -czf "librewands-$(version).tar.gz" "librewands-$(version)"
|
||||
doc: assets
|
||||
+cd Documentation/ && $(MAKE)
|
||||
|
||||
editMaps:
|
||||
cd Build/;gcc ../Source/editMaps.c -lncurses -O3 -o librewands_editmaps
|
||||
+cd Source/ && $(MAKE) CFLAGS="-O3 -Wall"
|
||||
|
||||
editMaps-debug:
|
||||
cd Build/;gcc ../Source/editMaps.c -lncurses -g3 -Og -Wall -fanalyzer -o librewands_editmaps
|
||||
+cd Source/ && $(MAKE) \
|
||||
CFLAGS="-Og -Wall -fanalyzer" \
|
||||
PROJECT=librewands_editmaps
|
||||
|
||||
test:
|
||||
cd Build/;gcc ../Tests/main.c -lncurses -g3 -Og -Wall -fanalyzer -o tests;./tests
|
||||
+cd Tests/ && $(MAKE)
|
||||
|
||||
format:
|
||||
clang-format -i Source/*
|
||||
clang-format -i Tests/*
|
||||
|
||||
+cd Source/ && $(MAKE) format
|
||||
+cd Tests/ && $(MAKE) format
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# This file is part of LibreWands.
|
||||
# LibreWands is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# LibreWands is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with LibreWands. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
.POSIX:
|
||||
|
||||
PROJECT = librewands
|
||||
LIBS = -lncurses
|
||||
|
||||
DEPS = \
|
||||
editMaps.o \
|
||||
engineCore.o \
|
||||
engineMaps.o \
|
||||
engineSound.o \
|
||||
playJoycon.o
|
||||
|
||||
SRCS = $(DEPS:.o=.c)
|
||||
|
||||
all: $(PROJECT)
|
||||
|
||||
install: $(PROJECT)
|
||||
mkdir -p $(PREFIX)/bin
|
||||
cp $(PROJECT) $(PREFIX)/bin
|
||||
|
||||
format: $(SRCS)
|
||||
clang-format -i $(SRCS)
|
||||
|
||||
$(PROJECT): $(DEPS)
|
||||
$(CC) $(DEPS) $(LDFLAGS) $(LIBS) -o $@
|
|
@ -0,0 +1,15 @@
|
|||
.POSIX:
|
||||
|
||||
PROJECT = test
|
||||
DEPS = main.o
|
||||
SRCS = $(DEPS:.o=.c)
|
||||
LIBS = -lncurses
|
||||
CFLAGS = -Wall -fanalyzer -Og -g3
|
||||
|
||||
all: $(PROJECT)
|
||||
|
||||
$(PROJECT): $(DEPS)
|
||||
$(CC) $(DEPS) $(LDFLAGS) $(LIBS) -o $@
|
||||
|
||||
format: $(SRCS)
|
||||
clang-format -i $(SRCS)
|
Loading…
Reference in New Issue