Makefile editswq

This commit is contained in:
John Alanbrook 2022-02-03 17:29:43 +00:00
parent 932863eb09
commit bb28b38741

View file

@ -1,6 +1,3 @@
procs != nproc
MAKEFLAGS = --jobs=$(procs)
UNAME != uname UNAME != uname
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@ -24,11 +21,11 @@ DIRS = engine pinball editor brainstorm
ETP = ./source/engine/thirdparty/ ETP = ./source/engine/thirdparty/
define make_objs 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|\.|./obj|1'
endef endef
define find_include define find_include
find $(1) -type f -name *.h | sed 's|\/[^\/]*\.h$$||' | sort | uniq find $(1) -type f -name '*.h' | sed 's|\/[^\/]*\.h$$||' | sort | uniq
endef endef
define prefix define prefix
@ -86,18 +83,19 @@ CLIBS != $(call prefix, $(CLIBS), -l)
LELIBS = -Wl,-Bstatic $(ELIBS) -Wl,-Bdynamic $(CLIBS) LELIBS = -Wl,-Bstatic $(ELIBS) -Wl,-Bdynamic $(CLIBS)
DEPENDS = $(bsobjects:.o=.d) $(eobjects:.o=.d) objects = $(bsobjects) $(eobjects) $(pinobjects)
DEPENDS = $(objects:.o=.d)
-include $(DEPENDS)
yuginec = ./source/engine/yugine.c yuginec = ./source/engine/yugine.c
.SECONARY: $(eobjects)
engine: libengine.a engine: libengine.a
@echo Linking engine Linking engine
$(CXX) $(yuginec) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o yugine $(CXX) $(yuginec) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o yugine
libengine.a: $(eobjects) libengine.a: $(eobjects)
@echo Making library engine.a @echo Making library engine.a
@ar -r libengine.a $(eobjects) @ar -r libengine.a $(eobjects)
xbrainstorm: libengine.a $(bsobjects) xbrainstorm: libengine.a $(bsobjects)
@ -110,8 +108,6 @@ pinball: libengine.a $(pinobjects)
@$(CXX) $(pinobjects) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@ @$(CXX) $(pinobjects) -DGLEW_STATIC $(includeflag) $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@
mv pinball paladin/pinball mv pinball paladin/pinball
-include $(DEPENDS)
$(objprefix)/%.o:%.cpp $(objprefix)/%.o:%.cpp
@mkdir -p $(@D) @mkdir -p $(@D)
@echo Making C++ object $@ @echo Making C++ object $@
@ -124,5 +120,4 @@ $(objprefix)/%.o:%.c
clean: clean:
@echo Cleaning project @echo Cleaning project
@rm -f $(eobjects) $(bsobjects) @rm -f $(eobjects) $(bsobjects)