Makefile edits

This commit is contained in:
John Alanbrook 2022-01-20 17:16:44 +00:00
parent a7378e1d17
commit 34d0565886
3 changed files with 26 additions and 17 deletions

View file

@ -33,11 +33,21 @@ edirs := $(filter-out %docs %doc %include% %src %examples , $(edirs))
eobjects := $(sort $(patsubst .%.cpp, $(objprefix)%.o, $(filter %.cpp, $(esrcs))) $(patsubst .%.c, $(objprefix)%.o, $(filter %.c, $(esrcs)))) eobjects := $(sort $(patsubst .%.cpp, $(objprefix)%.o, $(filter %.cpp, $(esrcs))) $(patsubst .%.c, $(objprefix)%.o, $(filter %.c, $(esrcs))))
edsrcs := $(shell find ./source/editor -name '*.c*') imguidir := ./source/editor/imgui/
imguisrcs := $(addprefix $(imguidir), imgui imgui_draw imgui_widgets imgui_tables backends/imgui_impl_sdl backends/imgui_impl_opengl3)
imguisrcs := $(addsuffix .cpp, $(imguisrcs))
imguiobjs := $(sort $(patsubst .%.cpp, $(objprefix)%.o, $(filter %.cpp, $(imguisrcs))) $(patsubst .%.c, $(objprefix)%.o, $(filter %.c, $(imguisrcs))))
edsrcs := $(wildcard ./source/editor/*)
edheaders := $(shell find ./source/editor -name '*.h') edheaders := $(shell find ./source/editor -name '*.h')
eddirs := $(shell find ./source/editor -type d) eddirs := $(shell find ./source/editor -type d)
edobjects := $(sort $(patsubst .%.cpp, $(objprefix)%.o, $(filter %.cpp, $(edsrcs))) $(patsubst .%.c, $(objprefix)%.o, $(filter %.c, $(edsrcs)))) edobjects := $(sort $(patsubst .%.cpp, $(objprefix)%.o, $(filter %.cpp, $(edsrcs))) $(patsubst .%.c, $(objprefix)%.o, $(filter %.c, $(edsrcs)))) $(imguiobjs)
eobjects := $(filter-out %yugine.o %pl_mpeg_extract_frames.o %pl_mpeg_player.o, $(eobjects)) $(edobjects)
edirs := $(edirs) $(eddirs)
bssrcs := $(shell find ./source/brainstorm -name '*.c*') bssrcs := $(shell find ./source/brainstorm -name '*.c*')
bsheaders := $(shell find ./source/brainstorm -name '*.h') bsheaders := $(shell find ./source/brainstorm -name '*.h')
@ -51,12 +61,13 @@ pindirs := $(shell find ./source/pinball -type d)
edobjects := $(sort $(patsubst .%.cpp, $(objprefix)%.o, $(filter %.cpp, $(edsrcs))) $(patsubst .%.c, $(objprefix)%.o, $(filter %.c, $(edsrcs)))) edobjects := $(sort $(patsubst .%.cpp, $(objprefix)%.o, $(filter %.cpp, $(edsrcs))) $(patsubst .%.c, $(objprefix)%.o, $(filter %.c, $(edsrcs))))
includeflag := $(addprefix -I, $(edirs) $(eddirs) $(pindirs) $(bsdirs)) includeflag := $(addprefix -I, $(edirs) $(eddirs) $(pindirs) $(bsdirs) ./source/editor ./source/editor/imgui ./source/editor/imgui/backends)
#COMPILER_FLAGS specifies the additional compilation options we're using #COMPILER_FLAGS specifies the additional compilation options we're using
WARNING_FLAGS := -w #-pedantic -Wall -Wextra -Wwrite-strings WARNING_FLAGS := -w #-pedantic -Wall -Wextra -Wwrite-strings
COMPILER_FLAGS := -g -O0 $(WARNING_FLAGS) COMPILER_FLAGS := -g -O0 $(WARNING_FLAGS)
LIBPATH := $(addprefix -L, .)
ifeq ($(UNAME), Windows_NT) ifeq ($(UNAME), Windows_NT)
LINKER_FLAGS:= -static LINKER_FLAGS:= -static
@ -66,42 +77,40 @@ ifeq ($(UNAME), Windows_NT)
EXT := .exe EXT := .exe
else else
LINKER_FLAGS := LINKER_FLAGS :=
ELIBS := ELIBS := engine
CLIBS := SDL2 SDL2_mixer GLEW GL dl pthread CLIBS := SDL2 SDL2_mixer GLEW GL dl pthread
EXT := EXT :=
endif endif
LELIBS := -Wl,-Bstatic $(addprefix -l, ${ELIBS}) -Wl,-Bdynamic $(addprefix -l, $(CLIBS)) LELIBS := -Wl,-Bstatic $(addprefix -l, ${ELIBS}) -Wl,-Bdynamic $(addprefix -l, $(CLIBS))
dir_guard = @mkdir -p $(@D)
FILENAME = $(TARGET)$(INFO)_$(UNAME_P)$(EXT)
eobjects := $(filter-out %yugine.o, $(eobjects)) yuginec := ./source/engine/yugine.c
.SECONARY: $(eobjects) .SECONARY: $(eobjects)
engine: engine.a engine: engine.a
@echo Linking engine @echo Linking engine
-$(CXX) $^ -DGLEW_STATIC $(LINKER_FLAGS) $(LELIBS) -o $@ $(CXX) $(yuginec) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o yugine
engine.a: $(eobjects) engine.a: $(eobjects)
@echo Making library engine.a @echo Making library engine.a
-@ar -rv engine.a $(eobjects) @ar -rv libengine.a $(eobjects)
brainstorms: engine.a $(bsobjects) brainstorms: engine.a $(bsobjects)
@echo Making brainstorm @echo Making brainstorm
$(CXX) $^ -DGLEW_STATIC $(LINKER_FLAGS) $(LELIBS) -o $@ $(CXX) $(bsobjects) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@
$(objprefix)/%.o:%.cpp $(objprefix)/%.o:%.cpp
$(dir_guard) @mkdir -p $(@D)
@echo Making C++ object $@ @echo Making C++ object $@
-@$(CXX) $(includeflag) $(COMPILER_FLAGS) -c $< -o $@ @$(CXX) $(includeflag) $(COMPILER_FLAGS) -c $< -o $@
$(objprefix)/%.o:%.c $(objprefix)/%.o:%.c
$(dir_guard) @mkdir -p $(@D)
@echo Making C object $@ @echo Making C object $@
$(CC) $(includeflag) $(COMPILER_FLAGS) -c $< -o $@ @$(CC) $(includeflag) $(COMPILER_FLAGS) -c $< -o $@
clean: clean:
@echo Cleaning project @echo Cleaning project

View file

@ -54,8 +54,8 @@
#include "imgui_impl_sdl.h" #include "imgui_impl_sdl.h"
// SDL // SDL
#include <SDL.h> #include <SDL2/SDL.h>
#include <SDL_syswm.h> #include <SDL2/SDL_syswm.h>
#if defined(__APPLE__) #if defined(__APPLE__)
#include <TargetConditionals.h> #include <TargetConditionals.h>
#endif #endif

View file

@ -1,7 +1,7 @@
#include "registry.h" #include "registry.h"
#include "gameobject.h" #include "gameobject.h"
#include "2dphysics.h" #include "2dphysics.h"
#include "editor.h" #include <editor.h>
#include "sprite.h" #include "sprite.h"
#include "pinball.h" #include "pinball.h"