commit b4c50e6c966d0860d5c5d82c8bb269039972d326 parent bc1f38fa6c70cc99df5af342dd8ef3ee843e0537 Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Apr 30 13:08:45 +0300 Build multiple bins instead of dynamic libs, add signing related tools Diffstat:
Makefile | | | 31 | ++++++++++++++++++------------- |
os.mk | | | 1 | - |
rules.mk | | | 5 | ----- |
diff --git a/Makefile b/Makefile @@ -1,25 +1,31 @@ -BINS := medfall pp sound srv launcher/launcher -MODULES := bsp.so btt.so hm.so sm.so +BINS := medfall sm bsp btt pp sound srv launcher/launcher utils/genkeys/genkeys utils/genkeys/sign STBS := truetype image image_write perlin VISITORS := visitors/linear_algebra.h -all: $(VISITORS) $(BINS) $(MODULES) test_lockfree +all: $(VISITORS) $(BINS) test_lockfree # Binary dependencies -medfall: main.o gl.o renderer.o immediate.o work_queue.o text_renderer.o stb_truetype.o glad.o libglfw.a libsquish.a +medfall: gl.o renderer.o immediate.o work_queue.o text_renderer.o stb_truetype.o glad.o libglfw.a libsquish.a pp: pp.o stb_image.o lz4.o lz4hc.o heightmap.o libsquish.a sound: audio.o mixer.o wave.o platform_audio_output.o srv: server/main.o launcher/launcher: launcher/main.o memory_arena.o http.o work_queue.o sha2.o gl.o glad.o libimgui.a stb_truetype.o libglfw.a libmonocypher.a +utils/genkeys/genkeys: utils/genkeys/genkeys.o libmonocypher.a +utils/genkeys/sign: utils/genkeys/sign.o libmonocypher.a + test_lockfree: relacy.cc $(CXX) relacy.cc -o test_lockfree $(CXXFLAGS) $(LDFLAGS) -std=c++98 -fexceptions -frtti -Wno-missing-field-initializers +# Common dependencies +BIN_COMMON_OBJS := log.o memory_arena.o ggformat.o strlcpy.o strlcat.o strtonum.o profiler.o stats.o rng/well512.o +DLL_COMMON_OBJS := log.o memory_arena.o work_queue.o immediate.o profiler.o text_renderer.o stb_truetype.o renderer.o ggformat.o strlcat.o strlcpy.o strtonum.o stats.o rng/well512.o libsquish.a glad.o main.o gl.o libglfw.a + # Module dependencies -bsp.so: bsp.o bsp_renderer.o -hm.so: hm.o heightmap.o terrain_manager.o lz4.o btt.o gpubtt.o skybox.o http.o -btt.so: mod_btt.o btt.o gpubtt.o heightmap.o skybox.o stb_image.o lz4.o -sm.so: shadow_map.o +medfall: hm.o heightmap.o terrain_manager.o lz4.o btt.o gpubtt.o skybox.o http.o $(DLL_COMMON_OBJS) +bsp: bsp.o bsp_renderer.o $(DLL_COMMON_OBJS) +btt: mod_btt.o btt.o gpubtt.o heightmap.o skybox.o stb_image.o lz4.o $(DLL_COMMON_OBJS) +sm: shadow_map.o libtinyobjloader.a $(DLL_COMMON_OBJS) # Special CXXFLAGS/LDFLAGS medfall: LDFLAGS += -Wl,--export-dynamic @@ -30,15 +36,12 @@ xxhash.o: CXXFLAGS += -O3 # Visitor headers visitors/linear_algebra.h: linear_algebra.h -# Common dependencies -BIN_COMMON_OBJS := log.o memory_arena.o ggformat.o strlcpy.o strlcat.o strtonum.o profiler.o stats.o rng/well512.o -DLL_COMMON_OBJS := log.o memory_arena.o work_queue.o immediate.o profiler.o text_renderer.o stb_truetype.o renderer.o ggformat.o strlcat.o strlcpy.o strtonum.o stats.o rng/well512.o libsquish.a - # Compiler flags WARNINGS := -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wconversion -Wshadow -Wcast-align -Wstrict-overflow -Werror=switch CXXFLAGS += -std=c++11 -msse2 -fno-exceptions -fno-rtti -I. \ -O0 \ - -ggdb3 -fno-omit-frame-pointer -fno-strict-aliasing -fno-strict-overflow + -ggdb3 -fno-omit-frame-pointer -fno-strict-aliasing -fno-strict-overflow \ + -DSTATIC_GAME LDFLAGS += -lm include os.mk @@ -46,3 +49,5 @@ include rules.mk include libs/glfw.mk include libs/imgui.mk +include libs/monocypher.mk +include libs/tinyobjloader.mk diff --git a/os.mk b/os.mk @@ -1,6 +1,5 @@ # Makefile OS detection ifeq ($(shell uname -s),Linux) - CXXFLAGS += -fPIC LDFLAGS += -ldl -lpthread -lX11 -lXrandr -lXinerama -lXcursor else ifeq ($(shell uname -s),Darwin) LDFLAGS += -framework OpenGL -lglfw3 diff --git a/rules.mk b/rules.mk @@ -15,11 +15,6 @@ $(STB_OBJS): %.o: %.h @printf "\e[1;32mbuilding $<\e[0m\n" @$(CXX) $(STB_CXXFLAGS) $(CXXFLAGS) -x c++ -c -o $@ $< -# Build the game modules -$(MODULES): %.so: $(COMMON_OBJS) - @printf "\e[1;33mbuilding $@\e[0m\n" - @$(CXX) -o $@ $^ $(LDFLAGS) -shared - # Build *.o from *.cc # The -M* stuff is for generating dependency lists %.o: %.cc