2018-06-26 02:26:48 +00:00
|
|
|
# This Makefile works for Mac OS X (El Capitan), MinGW, and Linux.
|
|
|
|
#
|
|
|
|
# For Mac OS X:
|
|
|
|
# Run "brew install sdl" to install SDL in /usr/local.
|
|
|
|
# Run "brew install sdl_gfx".
|
|
|
|
# Run "brew install sdl_mixer".
|
|
|
|
# Run "brew install sdl_ttf".
|
2021-03-21 21:40:06 +00:00
|
|
|
# Run "make" to build HyperRogue as ./hyperrogue.
|
2018-06-26 02:26:48 +00:00
|
|
|
#
|
|
|
|
# For MSYS2 and MinGW-w64:
|
|
|
|
# You might need to run commands such as "pacman -S mingw-w64-x86_64-SDL"
|
|
|
|
# to install SDL and other required libraries.
|
2021-03-21 21:40:06 +00:00
|
|
|
# Run "make" to build HyperRogue as ./hyperrogue.exe.
|
2018-06-26 02:26:48 +00:00
|
|
|
#
|
|
|
|
# For Ubuntu Linux:
|
|
|
|
# Run "sudo apt-get install libsdl-dev" to install SDL in /usr/local.
|
2021-03-21 21:40:06 +00:00
|
|
|
# Run "make" to build HyperRogue as ./hyperrogue.
|
2018-06-26 02:26:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
OS := mingw
|
|
|
|
TOOLCHAIN := mingw
|
|
|
|
else
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
|
|
OS := linux
|
|
|
|
else
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
OS := osx
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
TOOLCHAIN_VERSION_S := $(shell $(CXX) --version)
|
|
|
|
ifneq (,$(findstring clang,$(TOOLCHAIN_VERSION_S)))
|
|
|
|
TOOLCHAIN := clang
|
|
|
|
else
|
2020-02-15 21:22:15 +00:00
|
|
|
TOOLCHAIN := gcc
|
2018-06-26 02:26:48 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
## We have now finished inspecting the environment via $(shell).
|
|
|
|
## Begin customization points for each OS and TOOLCHAIN we support.
|
|
|
|
|
|
|
|
|
|
|
|
ifeq (${OS},linux)
|
|
|
|
CXXFLAGS_EARLY += -DLINUX
|
|
|
|
EXE_EXTENSION :=
|
|
|
|
LDFLAGS_GL := -lGL
|
|
|
|
LDFLAGS_GLEW := -lGLEW
|
|
|
|
LDFLAGS_PNG := -lpng
|
2020-01-25 23:30:13 +00:00
|
|
|
LDFLAGS_SDL := -lSDL -lSDL_gfx -lSDL_mixer -lSDL_ttf -lpthread -lz
|
2018-06-26 02:26:48 +00:00
|
|
|
OBJ_EXTENSION := .o
|
|
|
|
hyper_RES :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${OS},mingw)
|
|
|
|
CXXFLAGS_EARLY += -DWINDOWS -mwindows -D_A_VOLID=8
|
|
|
|
EXE_EXTENSION := .exe
|
|
|
|
LDFLAGS_GL := -lopengl32
|
|
|
|
LDFLAGS_GLEW := -lglew32
|
|
|
|
LDFLAGS_PNG := -lpng
|
2020-02-14 18:17:42 +00:00
|
|
|
LDFLAGS_SDL := -lSDL -lSDL_gfx -lSDL_mixer -lSDL_ttf -lpthread -lz
|
2018-06-26 02:26:48 +00:00
|
|
|
OBJ_EXTENSION := .o
|
|
|
|
hyper_RES := hyper.res
|
|
|
|
ifeq (${HYPERROGUE_USE_GLEW},)
|
|
|
|
HYPERROGUE_USE_GLEW := 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${OS},osx)
|
|
|
|
CXXFLAGS_EARLY += -DMAC -I/usr/local/include
|
|
|
|
EXE_EXTENSION :=
|
|
|
|
LDFLAGS_EARLY += -L/usr/local/lib
|
|
|
|
LDFLAGS_GL := -framework AppKit -framework OpenGL
|
|
|
|
LDFLAGS_GLEW := -lGLEW
|
|
|
|
LDFLAGS_PNG := -lpng
|
2020-02-14 18:17:42 +00:00
|
|
|
LDFLAGS_SDL := -lSDL -lSDLMain -lSDL_gfx -lSDL_mixer -lSDL_ttf -lpthread -lz
|
2018-06-26 02:26:48 +00:00
|
|
|
OBJ_EXTENSION := .o
|
|
|
|
hyper_RES :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${TOOLCHAIN},clang)
|
2020-04-03 19:11:12 +00:00
|
|
|
CXXFLAGS_STD = -std=c++11
|
2020-09-22 19:16:49 +00:00
|
|
|
CXXFLAGS_EARLY += -march=native -fPIC
|
2018-06-26 02:26:48 +00:00
|
|
|
CXXFLAGS_EARLY += -W -Wall -Wextra -Werror -pedantic
|
2020-02-22 05:20:08 +00:00
|
|
|
CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-unknown-warning-option
|
2018-06-26 02:26:48 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${TOOLCHAIN},gcc)
|
2020-04-03 19:11:12 +00:00
|
|
|
CXXFLAGS_STD = -std=c++11
|
2020-09-22 19:16:49 +00:00
|
|
|
CXXFLAGS_EARLY += -march=native -fPIC
|
2020-02-22 05:20:08 +00:00
|
|
|
CXXFLAGS_EARLY += -W -Wall -Wextra -Werror -pedantic
|
|
|
|
CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized
|
2018-06-26 02:26:48 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${TOOLCHAIN},mingw)
|
2020-04-03 19:11:12 +00:00
|
|
|
CXXFLAGS_STD = -std=c++11
|
|
|
|
CXXFLAGS_EARLY += -march=native
|
2018-06-26 02:26:48 +00:00
|
|
|
CXXFLAGS_EARLY += -W -Wall -Wextra -Werror
|
2020-02-22 05:20:08 +00:00
|
|
|
CXXFLAGS_EARLY += -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized
|
2018-06-26 02:26:48 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
## We have now finished OS-specific and TOOLCHAIN-specific computations.
|
|
|
|
## Begin customization points for user-specifiable HYPERROGUE_USE_XXX macros.
|
|
|
|
|
|
|
|
|
|
|
|
hyper_OBJS = hyper$(OBJ_EXTENSION)
|
|
|
|
hyper_LDFLAGS = $(LDFLAGS_GL) $(LDFLAGS_SDL)
|
|
|
|
|
|
|
|
ifeq (${HYPERROGUE_USE_GLEW},1)
|
|
|
|
CXXFLAGS_EARLY += -DCAP_GLEW=1
|
|
|
|
hyper_LDFLAGS += $(LDFLAGS_GLEW)
|
|
|
|
else
|
|
|
|
CXXFLAGS_EARLY += -DCAP_GLEW=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${HYPERROGUE_USE_PNG},1)
|
|
|
|
CXXFLAGS_EARLY += -DCAP_PNG=1
|
|
|
|
hyper_LDFLAGS += $(LDFLAGS_PNG)
|
|
|
|
hyper_OBJS += savepng$(OBJ_EXTENSION)
|
|
|
|
else
|
|
|
|
CXXFLAGS_EARLY += -DCAP_PNG=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${HYPERROGUE_USE_ROGUEVIZ},1)
|
2020-04-03 19:11:12 +00:00
|
|
|
# Enable RogueViz. RogueViz requires C++17.
|
|
|
|
CXXFLAGS_STD = -std=c++17
|
2018-06-26 02:26:48 +00:00
|
|
|
CXXFLAGS_EARLY += -DCAP_ROGUEVIZ=1
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
## We have now finished HYPERROGUE_USE_XXX-specific computations.
|
|
|
|
## Begin the Makefile proper.
|
|
|
|
|
|
|
|
|
2020-04-03 19:11:12 +00:00
|
|
|
override CXXFLAGS := $(CXXFLAGS_STD) $(CXXFLAGS_EARLY) $(CXXFLAGS) ${EXTRA_CXXFLAGS}
|
2018-06-26 02:26:48 +00:00
|
|
|
override LDFLAGS := $(LDFLAGS_EARLY) $(LDFLAGS) ${EXTRA_LDFLAGS}
|
|
|
|
|
|
|
|
hyperrogue$(EXE_EXTENSION): $(hyper_OBJS) $(hyper_RES)
|
|
|
|
$(CXX) $(CXXFLAGS) $(hyper_OBJS) $(hyper_RES) $(LDFLAGS) $(hyper_LDFLAGS) -o $@
|
|
|
|
|
2019-09-13 16:26:51 +00:00
|
|
|
hyper$(OBJ_EXTENSION): *.cpp language-data.cpp autohdr.h
|
2018-06-27 01:55:19 +00:00
|
|
|
$(CXX) -O2 $(CXXFLAGS) $(hyper_CXXFLAGS) -c hyper.cpp -o $@
|
2018-06-26 02:26:48 +00:00
|
|
|
|
|
|
|
hyper.res: hyper.rc hr-icon.ico
|
|
|
|
windres hyper.rc -O coff -o hyper.res
|
|
|
|
|
|
|
|
langen$(EXE_EXTENSION): langen.cpp language-??.cpp language-ptbr.cpp
|
|
|
|
$(CXX) -O0 $(CXXFLAGS) $(langen_CXXFLAGS) langen.cpp $(LDFLAGS) -o $@
|
|
|
|
|
2019-09-13 16:20:50 +00:00
|
|
|
makeh$(EXE_EXTENSION): makeh.cpp
|
Make "mymake" work on OSX, and add it to Travis.
Fix a -Wformat bug exposed by compiling with Clang.
To preprocess C++11 code, you need `g++ -E -std=c++11`, not just
`g++ -E`. (The old code worked for GCC 6+ and Clang 6+ because they
changed the default mode from C++03 to C++14. But for GCC 5, we still
need `-std=c++11`. And regardless, it's a good idea.)
Add a "-mac" option to mymake, and cleanly factor out `set_mac`,
`set_linux`, and `set_win`. When you build mymake using
`make -f Makefile.simple mymake`, you get a mymake that knows what
platform it's on. This means you don't have to pass `mymake -mac`
on OSX, nor `mymake -win` on Windows.
The old code put `INCLUDE(___hyper-main.cpp)` into a C++ file that
would be preprocessed, which doesn't work because libSDL does
essentially `-Dmain=SDL_main`, which turns this into
`INCLUDE(___hyper-SDL_main.cpp)`, which gives us
a "file not found" error from mymake. The solution is to put
filenames into quotation marks, so that the string "main" never
appears as a token in the C++ file. (Alternatively, we could have
renamed "hyper-main.cpp" to "hypermain.cpp".)
Add several new "mymake" entries in the Travis build matrix,
and add the "mymake" builds' badge to the README.
2020-04-04 02:01:26 +00:00
|
|
|
$(CXX) -O2 makeh.cpp -o $@
|
2019-09-13 16:20:50 +00:00
|
|
|
|
2020-05-16 23:42:33 +00:00
|
|
|
autohdr.h: makeh$(EXE_EXTENSION) language-data.cpp *.cpp
|
2021-03-25 09:56:20 +00:00
|
|
|
./makeh classes.cpp locations.cpp colors.cpp hyperpoint.cpp geometry.cpp goldberg.cpp init.cpp floorshapes.cpp cell.cpp multi.cpp shmup.cpp pattern2.cpp mapeditor.cpp graph.cpp textures.cpp hprint.cpp language.cpp util.cpp complex.cpp *.cpp > autohdr.h
|
2019-09-13 16:20:50 +00:00
|
|
|
|
2018-06-26 02:26:48 +00:00
|
|
|
language-data.cpp: langen$(EXE_EXTENSION)
|
|
|
|
./langen > language-data.cpp
|
|
|
|
|
|
|
|
savepng$(OBJ_EXTENSION): savepng.cpp
|
2018-06-27 01:55:19 +00:00
|
|
|
$(CXX) -O2 $(CXXFLAGS) -c savepng.cpp -o $@
|
|
|
|
|
Make "mymake" work on OSX, and add it to Travis.
Fix a -Wformat bug exposed by compiling with Clang.
To preprocess C++11 code, you need `g++ -E -std=c++11`, not just
`g++ -E`. (The old code worked for GCC 6+ and Clang 6+ because they
changed the default mode from C++03 to C++14. But for GCC 5, we still
need `-std=c++11`. And regardless, it's a good idea.)
Add a "-mac" option to mymake, and cleanly factor out `set_mac`,
`set_linux`, and `set_win`. When you build mymake using
`make -f Makefile.simple mymake`, you get a mymake that knows what
platform it's on. This means you don't have to pass `mymake -mac`
on OSX, nor `mymake -win` on Windows.
The old code put `INCLUDE(___hyper-main.cpp)` into a C++ file that
would be preprocessed, which doesn't work because libSDL does
essentially `-Dmain=SDL_main`, which turns this into
`INCLUDE(___hyper-SDL_main.cpp)`, which gives us
a "file not found" error from mymake. The solution is to put
filenames into quotation marks, so that the string "main" never
appears as a token in the C++ file. (Alternatively, we could have
renamed "hyper-main.cpp" to "hypermain.cpp".)
Add several new "mymake" entries in the Travis build matrix,
and add the "mymake" builds' badge to the README.
2020-04-04 02:01:26 +00:00
|
|
|
mymake$(EXE_EXTENSION): mymake.cpp
|
2020-05-28 17:00:33 +00:00
|
|
|
$(CXX) -O2 $(CXXFLAGS) mymake.cpp -pthread -o $@
|
Make "mymake" work on OSX, and add it to Travis.
Fix a -Wformat bug exposed by compiling with Clang.
To preprocess C++11 code, you need `g++ -E -std=c++11`, not just
`g++ -E`. (The old code worked for GCC 6+ and Clang 6+ because they
changed the default mode from C++03 to C++14. But for GCC 5, we still
need `-std=c++11`. And regardless, it's a good idea.)
Add a "-mac" option to mymake, and cleanly factor out `set_mac`,
`set_linux`, and `set_win`. When you build mymake using
`make -f Makefile.simple mymake`, you get a mymake that knows what
platform it's on. This means you don't have to pass `mymake -mac`
on OSX, nor `mymake -win` on Windows.
The old code put `INCLUDE(___hyper-main.cpp)` into a C++ file that
would be preprocessed, which doesn't work because libSDL does
essentially `-Dmain=SDL_main`, which turns this into
`INCLUDE(___hyper-SDL_main.cpp)`, which gives us
a "file not found" error from mymake. The solution is to put
filenames into quotation marks, so that the string "main" never
appears as a token in the C++ file. (Alternatively, we could have
renamed "hyper-main.cpp" to "hypermain.cpp".)
Add several new "mymake" entries in the Travis build matrix,
and add the "mymake" builds' badge to the README.
2020-04-04 02:01:26 +00:00
|
|
|
|
2018-06-27 01:55:19 +00:00
|
|
|
emscripten: hyper.html
|
|
|
|
|
|
|
|
%.html %.js %.wasm: %.emscripten-sources
|
2020-03-08 00:31:03 +00:00
|
|
|
emcc -std=c++11 -O3 -s USE_ZLIB=1 -s LEGACY_GL_EMULATION=1 -s TOTAL_MEMORY=128MB hyperweb.cpp -o hyper.html
|
2018-06-27 01:55:19 +00:00
|
|
|
|
2019-09-13 17:38:04 +00:00
|
|
|
hyper.emscripten-sources: *.cpp autohdr.h
|
2018-06-26 02:26:48 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
2020-03-31 19:53:01 +00:00
|
|
|
rm -f langen$(EXE_EXTENSION) language-data.cpp
|
|
|
|
rm -f makeh$(EXE_EXTENSION) autohdr.h
|
Make "mymake" work on OSX, and add it to Travis.
Fix a -Wformat bug exposed by compiling with Clang.
To preprocess C++11 code, you need `g++ -E -std=c++11`, not just
`g++ -E`. (The old code worked for GCC 6+ and Clang 6+ because they
changed the default mode from C++03 to C++14. But for GCC 5, we still
need `-std=c++11`. And regardless, it's a good idea.)
Add a "-mac" option to mymake, and cleanly factor out `set_mac`,
`set_linux`, and `set_win`. When you build mymake using
`make -f Makefile.simple mymake`, you get a mymake that knows what
platform it's on. This means you don't have to pass `mymake -mac`
on OSX, nor `mymake -win` on Windows.
The old code put `INCLUDE(___hyper-main.cpp)` into a C++ file that
would be preprocessed, which doesn't work because libSDL does
essentially `-Dmain=SDL_main`, which turns this into
`INCLUDE(___hyper-SDL_main.cpp)`, which gives us
a "file not found" error from mymake. The solution is to put
filenames into quotation marks, so that the string "main" never
appears as a token in the C++ file. (Alternatively, we could have
renamed "hyper-main.cpp" to "hypermain.cpp".)
Add several new "mymake" entries in the Travis build matrix,
and add the "mymake" builds' badge to the README.
2020-04-04 02:01:26 +00:00
|
|
|
rm -rf mymake$(EXE_EXTENSION) mymake_files/
|
2020-03-31 19:53:01 +00:00
|
|
|
rm -f hyperrogue$(EXE_EXTENSION) hyper$(OBJ_EXTENSION) $(hyper_RES) savepng$(OBJ_EXTENSION)
|
2018-06-27 01:55:19 +00:00
|
|
|
rm -f hyper.html hyper.js hyper.wasm
|