medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 28036a4c081bb6b5daa18bf93bbfa549b38e4ba5
parent d87e5f4286a6ce81175ee895af4aa73d507000d5
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat Jan 30 14:43:05 +0000

Split bits of Makefile into os.mk and rules.mk

Diffstat:
Makefile | 40++--------------------------------------
os.mk | 8++++++++
rules.mk | 32++++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+), 38 deletions(-)
diff --git a/Makefile b/Makefile @@ -25,41 +25,5 @@ CXXFLAGS += -std=c++11 -O2 \ -msse3 -ggdb3 -fno-omit-frame-pointer $(WARNINGS) -DGL_GLEXT_PROTOTYPES -DGLFW_INCLUDE_NONE -fno-exceptions LDFLAGS += -lm -pthread -# The STB libraries need you to pass -DSTB_*_IMPLEMENTATION to get the actual code -STB_CXXFLAGS := $(shell echo $(addprefix -DSTB_,$(addsuffix _IMPLEMENTATION,$(STBS))) | tr a-z A-Z) - -# OS detection -ifneq ($(shell uname -s),Darwin) - CXXFLAGS += -fPIC - LDFLAGS += -lGL -lGLEW -lglfw -ldl -lasound -else - LDFLAGS += -framework OpenGL -lglfw3 -endif - -# Create the binaries -$(BINS): %: - $(CXX) -o $@ $^ $(LDFLAGS) - -# Create stb_*.cc and then stb_*.o -STB_OBJS := $(addprefix stb_,$(addsuffix .o,$(STBS))) -STB_CCS := $(addprefix stb_,$(addsuffix .cc,$(STBS))) - -$(STB_CCS): %.cc: %.h - cp $^ $*.cc - -$(STB_OBJS): %.o: %.cc - $(CXX) -c -o $@ $*.cc $(CXXFLAGS) $(STB_CXXFLAGS) - -# Build the game modules -$(MODULES): %.so: $(COMMON_OBJS) - $(CXX) -o $@ $^ $(LDFLAGS) -shared - -# Build *.o from *.cc -# The -M* stuff is for generating dependency lists -%.o: %.cc - $(CXX) -c -o $@ $< -MMD -MP -MF .deps/$*.d $(CXXFLAGS) - -clean: - rm -f $(BINS) $(MODULES) *.o *.so $(STB_CCS) - --include .deps/*.d +-include os.mk +-include rules.mk diff --git a/os.mk b/os.mk @@ -0,0 +1,8 @@ +# Makefile OS detection +ifneq ($(shell uname -s),Darwin) + CXXFLAGS += -fPIC + LDFLAGS += -lGL -lGLEW -lglfw -ldl -lasound +else + LDFLAGS += -framework OpenGL -lglfw3 +endif + diff --git a/rules.mk b/rules.mk @@ -0,0 +1,32 @@ +# This file contains Makefile rules to actually build things + +# The STB libraries need you to pass -DSTB_*_IMPLEMENTATION to get the actual code +STB_CXXFLAGS := $(shell echo $(addprefix -DSTB_,$(addsuffix _IMPLEMENTATION,$(STBS))) | tr a-z A-Z) + +# Create the binaries +$(BINS): %: + $(CXX) -o $@ $^ $(LDFLAGS) + +# Create stb_*.cc and then stb_*.o +STB_OBJS := $(addprefix stb_,$(addsuffix .o,$(STBS))) +STB_CCS := $(addprefix stb_,$(addsuffix .cc,$(STBS))) + +$(STB_CCS): %.cc: %.h + cp $^ $*.cc + +$(STB_OBJS): %.o: %.cc + $(CXX) -c -o $@ $*.cc $(CXXFLAGS) $(STB_CXXFLAGS) + +# Build the game modules +$(MODULES): %.so: $(COMMON_OBJS) + $(CXX) -o $@ $^ $(LDFLAGS) -shared + +# Build *.o from *.cc +# The -M* stuff is for generating dependency lists +%.o: %.cc + $(CXX) -c -o $@ $< -MMD -MP -MF .deps/$*.d $(CXXFLAGS) + +clean: + rm -f $(BINS) $(MODULES) *.o *.so $(STB_CCS) + +-include .deps/*.d