From 0ba7b441b16a3c28acc0fe55d6c2e3ff540559cd Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Fri, 4 Feb 2022 14:38:25 +0000 Subject: [PATCH] Folder restructure --- Makefile | 52 +++++++++++++++---- .../{ => include}/bitmap-outliner-print.h | 0 .../{ => include}/bitmap-outliner.h | 0 .../thirdparty/cgltf/{ => include}/cgltf.h | 0 .../cgltf/{ => include}/cgltf_write.h | 0 .../pl_mpeg/{ => include}/pl_mpeg.h | 0 .../thirdparty/s7/{ => include}/mus-config.h | 0 .../engine/thirdparty/s7/{ => include}/s7.h | 0 .../sqlite3/{ => include}/sqlite3.h | 0 .../sqlite3/{ => include}/sqlite3ext.h | 0 .../stb/{ => include}/stb_c_lexer.h | 0 .../{ => include}/stb_connected_components.h | 0 .../thirdparty/stb/{ => include}/stb_divide.h | 0 .../thirdparty/stb/{ => include}/stb_ds.h | 0 .../thirdparty/stb/{ => include}/stb_dxt.h | 0 .../stb/{ => include}/stb_easy_font.h | 0 .../{ => include}/stb_herringbone_wang_tile.h | 0 .../stb/{ => include}/stb_hexwave.h | 0 .../thirdparty/stb/{ => include}/stb_image.h | 0 .../stb/{ => include}/stb_image_resize.h | 0 .../stb/{ => include}/stb_image_write.h | 0 .../stb/{ => include}/stb_include.h | 0 .../stb/{ => include}/stb_leakcheck.h | 0 .../stb/{ => include}/stb_rect_pack.h | 0 .../stb/{ => include}/stb_sprintf.h | 0 .../stb/{ => include}/stb_textedit.h | 0 .../stb/{ => include}/stb_tilemap_editor.h | 0 .../stb/{ => include}/stb_truetype.h | 0 .../stb/{ => include}/stb_voxel_render.h | 0 29 files changed, 41 insertions(+), 11 deletions(-) rename source/engine/thirdparty/bitmap-outliner/{ => include}/bitmap-outliner-print.h (100%) rename source/engine/thirdparty/bitmap-outliner/{ => include}/bitmap-outliner.h (100%) rename source/engine/thirdparty/cgltf/{ => include}/cgltf.h (100%) rename source/engine/thirdparty/cgltf/{ => include}/cgltf_write.h (100%) rename source/engine/thirdparty/pl_mpeg/{ => include}/pl_mpeg.h (100%) rename source/engine/thirdparty/s7/{ => include}/mus-config.h (100%) rename source/engine/thirdparty/s7/{ => include}/s7.h (100%) rename source/engine/thirdparty/sqlite3/{ => include}/sqlite3.h (100%) rename source/engine/thirdparty/sqlite3/{ => include}/sqlite3ext.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_c_lexer.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_connected_components.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_divide.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_ds.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_dxt.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_easy_font.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_herringbone_wang_tile.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_hexwave.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_image.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_image_resize.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_image_write.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_include.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_leakcheck.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_rect_pack.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_sprintf.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_textedit.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_tilemap_editor.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_truetype.h (100%) rename source/engine/thirdparty/stb/{ => include}/stb_voxel_render.h (100%) diff --git a/Makefile b/Makefile index 5222b585..d46877fb 100755 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +procs != nproc +MAKEFLAGS = --jobs=$(procs) + UNAME != uname ifeq ($(OS),Windows_NT) @@ -15,13 +18,17 @@ ifeq ($(DEBUG), 1) INFO = dbg endif -objprefix = ./obj +objprefix = ./bin/obj DIRS = engine pinball editor brainstorm ETP = ./source/engine/thirdparty/ define make_objs - find $(1) -type f -name '*.c' -o -name '*.cpp' | sed 's|\.c.*|.o|' | sed 's|\.|./obj|1' + find $(1) -type f -name '*.c' -o -name '*.cpp' | sed 's|\.c.*|.o|' | sed 's|\.|$(objprefix)|1' +endef + +define make_obj + echo $(1) | tr " " "\n" | sed 's|\.c.*|.o|' | sed 's|\.|$(objprefix)|1' endef define find_include @@ -39,8 +46,14 @@ define rm rm $${tmp} endef +define findindir + find $(1) -type f -maxdepth 1 -name '$(2)' +endef + # All other sources -edirs != $(call find_include, ./source/engine) +edirs != find ./source/engine -type d -name include +edirs += ./source/engine +ehead != $(call findindir,./source/engine,*.h) eobjects != $(call make_objs, ./source/engine) eobjects != $(call rm,$(eobjects),sqlite s7 pl_mpeg_extract_frames pl_mpeg_player) @@ -48,7 +61,11 @@ imguisrcs = imgui imgui_draw imgui_widgets imgui_tables backends/imgui_impl_sdl imguiobjs != $(call prefix,$(imguisrcs),./source/editor/imgui/,.o) eddirs != find ./source/editor -type d -edobjects != $(call make_objs, ./source/editor) +eddirs += ./source/editor +edhead != $(call findindir,./source/editor,*.h) +edobjects != find ./source/editor -type f -maxdepth 1 -name '*.c' -o -name '*.cpp' +edobjects != $(call make_obj,$(edobjects)) +edobjects += $(imguiobjs) bsdirs != find ./source/brainstorm -type d bsobjects != $(call make_objs, ./source/brainstorm) @@ -63,7 +80,7 @@ includeflag != $(call prefix,$(edirs) $(eddirs) $(pindirs) $(bsdirs),-I) WARNING_FLAGS = -w #-pedantic -Wall -Wextra -Wwrite-strings COMPILER_FLAGS = -g -O0 $(WARNING_FLAGS) -LIBPATH = -L. +LIBPATH = -L./bin ifeq ($(UNAME), Windows_NT) LINKER_FLAGS = -static -DSDL_MAIN_HANDLED @@ -89,23 +106,36 @@ DEPENDS = $(objects:.o=.d) yuginec = ./source/engine/yugine.c +LINK = $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) + engine: libengine.a - Linking engine - $(CXX) $(yuginec) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o yugine + @echo Linking engine + $(CXX) $(yuginec) -DGLEW_STATIC $(LINK) -o engine -libengine.a: $(eobjects) +editor: ./bin/libengine.a ./bin/libeditor.a + @echo Linking editor + $(CXX) $(yuginec) -DGLEW_STATIC $(LINK) -o editor + +./bin/libengine.a: $(eobjects) @echo Making library engine.a - @ar -r libengine.a $(eobjects) + @mv libengine.a bin/libengine.a + @cp $() bin/include + +./bin/libeditor.a: $(edobjects) + @echo Making editor library + @ar -r libeditor.a $(edobjects) + @mv libeditor.a bin/libeditor.a + @cp $(edhead) bin/include xbrainstorm: libengine.a $(bsobjects) @echo Making brainstorm - @$(CXX) $(bsobjects) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@ + @$(CXX) $(bsobjects) -DGLEW_STATIC $(LINK) -o $@ mv xbrainstorm brainstorm/brainstorm$(EXT) pinball: libengine.a $(pinobjects) @echo Making pinball - @$(CXX) $(pinobjects) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@ + @$(CXX) $(pinobjects) -DGLEW_STATIC $(LINK) -o $@ mv pinball paladin/pinball $(objprefix)/%.o:%.cpp diff --git a/source/engine/thirdparty/bitmap-outliner/bitmap-outliner-print.h b/source/engine/thirdparty/bitmap-outliner/include/bitmap-outliner-print.h similarity index 100% rename from source/engine/thirdparty/bitmap-outliner/bitmap-outliner-print.h rename to source/engine/thirdparty/bitmap-outliner/include/bitmap-outliner-print.h diff --git a/source/engine/thirdparty/bitmap-outliner/bitmap-outliner.h b/source/engine/thirdparty/bitmap-outliner/include/bitmap-outliner.h similarity index 100% rename from source/engine/thirdparty/bitmap-outliner/bitmap-outliner.h rename to source/engine/thirdparty/bitmap-outliner/include/bitmap-outliner.h diff --git a/source/engine/thirdparty/cgltf/cgltf.h b/source/engine/thirdparty/cgltf/include/cgltf.h similarity index 100% rename from source/engine/thirdparty/cgltf/cgltf.h rename to source/engine/thirdparty/cgltf/include/cgltf.h diff --git a/source/engine/thirdparty/cgltf/cgltf_write.h b/source/engine/thirdparty/cgltf/include/cgltf_write.h similarity index 100% rename from source/engine/thirdparty/cgltf/cgltf_write.h rename to source/engine/thirdparty/cgltf/include/cgltf_write.h diff --git a/source/engine/thirdparty/pl_mpeg/pl_mpeg.h b/source/engine/thirdparty/pl_mpeg/include/pl_mpeg.h similarity index 100% rename from source/engine/thirdparty/pl_mpeg/pl_mpeg.h rename to source/engine/thirdparty/pl_mpeg/include/pl_mpeg.h diff --git a/source/engine/thirdparty/s7/mus-config.h b/source/engine/thirdparty/s7/include/mus-config.h similarity index 100% rename from source/engine/thirdparty/s7/mus-config.h rename to source/engine/thirdparty/s7/include/mus-config.h diff --git a/source/engine/thirdparty/s7/s7.h b/source/engine/thirdparty/s7/include/s7.h similarity index 100% rename from source/engine/thirdparty/s7/s7.h rename to source/engine/thirdparty/s7/include/s7.h diff --git a/source/engine/thirdparty/sqlite3/sqlite3.h b/source/engine/thirdparty/sqlite3/include/sqlite3.h similarity index 100% rename from source/engine/thirdparty/sqlite3/sqlite3.h rename to source/engine/thirdparty/sqlite3/include/sqlite3.h diff --git a/source/engine/thirdparty/sqlite3/sqlite3ext.h b/source/engine/thirdparty/sqlite3/include/sqlite3ext.h similarity index 100% rename from source/engine/thirdparty/sqlite3/sqlite3ext.h rename to source/engine/thirdparty/sqlite3/include/sqlite3ext.h diff --git a/source/engine/thirdparty/stb/stb_c_lexer.h b/source/engine/thirdparty/stb/include/stb_c_lexer.h similarity index 100% rename from source/engine/thirdparty/stb/stb_c_lexer.h rename to source/engine/thirdparty/stb/include/stb_c_lexer.h diff --git a/source/engine/thirdparty/stb/stb_connected_components.h b/source/engine/thirdparty/stb/include/stb_connected_components.h similarity index 100% rename from source/engine/thirdparty/stb/stb_connected_components.h rename to source/engine/thirdparty/stb/include/stb_connected_components.h diff --git a/source/engine/thirdparty/stb/stb_divide.h b/source/engine/thirdparty/stb/include/stb_divide.h similarity index 100% rename from source/engine/thirdparty/stb/stb_divide.h rename to source/engine/thirdparty/stb/include/stb_divide.h diff --git a/source/engine/thirdparty/stb/stb_ds.h b/source/engine/thirdparty/stb/include/stb_ds.h similarity index 100% rename from source/engine/thirdparty/stb/stb_ds.h rename to source/engine/thirdparty/stb/include/stb_ds.h diff --git a/source/engine/thirdparty/stb/stb_dxt.h b/source/engine/thirdparty/stb/include/stb_dxt.h similarity index 100% rename from source/engine/thirdparty/stb/stb_dxt.h rename to source/engine/thirdparty/stb/include/stb_dxt.h diff --git a/source/engine/thirdparty/stb/stb_easy_font.h b/source/engine/thirdparty/stb/include/stb_easy_font.h similarity index 100% rename from source/engine/thirdparty/stb/stb_easy_font.h rename to source/engine/thirdparty/stb/include/stb_easy_font.h diff --git a/source/engine/thirdparty/stb/stb_herringbone_wang_tile.h b/source/engine/thirdparty/stb/include/stb_herringbone_wang_tile.h similarity index 100% rename from source/engine/thirdparty/stb/stb_herringbone_wang_tile.h rename to source/engine/thirdparty/stb/include/stb_herringbone_wang_tile.h diff --git a/source/engine/thirdparty/stb/stb_hexwave.h b/source/engine/thirdparty/stb/include/stb_hexwave.h similarity index 100% rename from source/engine/thirdparty/stb/stb_hexwave.h rename to source/engine/thirdparty/stb/include/stb_hexwave.h diff --git a/source/engine/thirdparty/stb/stb_image.h b/source/engine/thirdparty/stb/include/stb_image.h similarity index 100% rename from source/engine/thirdparty/stb/stb_image.h rename to source/engine/thirdparty/stb/include/stb_image.h diff --git a/source/engine/thirdparty/stb/stb_image_resize.h b/source/engine/thirdparty/stb/include/stb_image_resize.h similarity index 100% rename from source/engine/thirdparty/stb/stb_image_resize.h rename to source/engine/thirdparty/stb/include/stb_image_resize.h diff --git a/source/engine/thirdparty/stb/stb_image_write.h b/source/engine/thirdparty/stb/include/stb_image_write.h similarity index 100% rename from source/engine/thirdparty/stb/stb_image_write.h rename to source/engine/thirdparty/stb/include/stb_image_write.h diff --git a/source/engine/thirdparty/stb/stb_include.h b/source/engine/thirdparty/stb/include/stb_include.h similarity index 100% rename from source/engine/thirdparty/stb/stb_include.h rename to source/engine/thirdparty/stb/include/stb_include.h diff --git a/source/engine/thirdparty/stb/stb_leakcheck.h b/source/engine/thirdparty/stb/include/stb_leakcheck.h similarity index 100% rename from source/engine/thirdparty/stb/stb_leakcheck.h rename to source/engine/thirdparty/stb/include/stb_leakcheck.h diff --git a/source/engine/thirdparty/stb/stb_rect_pack.h b/source/engine/thirdparty/stb/include/stb_rect_pack.h similarity index 100% rename from source/engine/thirdparty/stb/stb_rect_pack.h rename to source/engine/thirdparty/stb/include/stb_rect_pack.h diff --git a/source/engine/thirdparty/stb/stb_sprintf.h b/source/engine/thirdparty/stb/include/stb_sprintf.h similarity index 100% rename from source/engine/thirdparty/stb/stb_sprintf.h rename to source/engine/thirdparty/stb/include/stb_sprintf.h diff --git a/source/engine/thirdparty/stb/stb_textedit.h b/source/engine/thirdparty/stb/include/stb_textedit.h similarity index 100% rename from source/engine/thirdparty/stb/stb_textedit.h rename to source/engine/thirdparty/stb/include/stb_textedit.h diff --git a/source/engine/thirdparty/stb/stb_tilemap_editor.h b/source/engine/thirdparty/stb/include/stb_tilemap_editor.h similarity index 100% rename from source/engine/thirdparty/stb/stb_tilemap_editor.h rename to source/engine/thirdparty/stb/include/stb_tilemap_editor.h diff --git a/source/engine/thirdparty/stb/stb_truetype.h b/source/engine/thirdparty/stb/include/stb_truetype.h similarity index 100% rename from source/engine/thirdparty/stb/stb_truetype.h rename to source/engine/thirdparty/stb/include/stb_truetype.h diff --git a/source/engine/thirdparty/stb/stb_voxel_render.h b/source/engine/thirdparty/stb/include/stb_voxel_render.h similarity index 100% rename from source/engine/thirdparty/stb/stb_voxel_render.h rename to source/engine/thirdparty/stb/include/stb_voxel_render.h