Updated mingw Makefile.

This commit is contained in:
aap 2014-12-24 14:32:39 +01:00
parent 5842f6221b
commit fa45dfd19b
2 changed files with 18 additions and 7 deletions

View File

@ -1,13 +1,19 @@
# null, opengl
BUILD=null
# e.g. null -> -DRW_NULL
BUILDDEF:=$(shell echo $(BUILD) | tr a-z A-Z | sed 's/^/-DRW_/')
BUILDDIR=build-$(BUILD)
SRCDIR=src SRCDIR=src
BUILDDIR=build
SRC := $(patsubst %.cpp,$(SRCDIR)/%.cpp, rwbase.cpp clump.cpp\ SRC := $(patsubst %.cpp,$(SRCDIR)/%.cpp, rwbase.cpp clump.cpp\
geometry.cpp plugins.cpp ps2.cpp\ geometry.cpp plugins.cpp ps2.cpp\
ogl.cpp) ogl.cpp)
OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SRC)) OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SRC))
DEP := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.d,$(SRC)) DEP := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.d,$(SRC))
CFLAGS=-Wall -Wextra -g -DGLEW_STATIC #-Wno-parentheses #-Wconversion CFLAGS=-Wall -Wextra -g -DGLEW_STATIC $(BUILDDEF) #-Wno-parentheses #-Wconversion
LIB=librw-$(BUILD).a
librw.a: $(OBJ) $(LIB): $(OBJ)
ar scr $@ $(OBJ) ar scr $@ $(OBJ)
$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp $(BUILDDIR)/%.o: $(SRCDIR)/%.cpp
@ -16,4 +22,7 @@ $(BUILDDIR)/%.o: $(SRCDIR)/%.cpp
$(BUILDDIR)/%.d: $(SRCDIR)/%.cpp $(BUILDDIR)/%.d: $(SRCDIR)/%.cpp
$(CXX) -MM -MT '$(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$<)' $(CFLAGS) $< > $@ $(CXX) -MM -MT '$(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$<)' $(CFLAGS) $< > $@
clean:
rm -f $(BUILDDIR)/*.[od]
-include $(DEP) -include $(DEP)

View File

@ -430,13 +430,14 @@ Texture::streamWrite(ostream &stream)
WriteChunkHeader(stream, ID_STRUCT, 4); WriteChunkHeader(stream, ID_STRUCT, 4);
writeUInt32(this->filterAddressing, stream); writeUInt32(this->filterAddressing, stream);
size = strnlen(this->name, 32)+3 & ~3; // TODO: length can't be > 32
size = strlen(this->name)+3 & ~3;
if(size < 4) if(size < 4)
size = 4; size = 4;
WriteChunkHeader(stream, ID_STRING, size); WriteChunkHeader(stream, ID_STRING, size);
stream.write(this->name, size); stream.write(this->name, size);
size = strnlen(this->mask, 32)+3 & ~3; size = strlen(this->mask)+3 & ~3;
if(size < 4) if(size < 4)
size = 4; size = 4;
WriteChunkHeader(stream, ID_STRING, size); WriteChunkHeader(stream, ID_STRING, size);
@ -453,9 +454,10 @@ Texture::streamGetSize(void)
int strsize; int strsize;
size += 12 + 4; size += 12 + 4;
size += 12 + 12; size += 12 + 12;
strsize = strnlen(this->name, 32)+3 & ~3; // TODO: see above
strsize = strlen(this->name)+3 & ~3;
size += strsize < 4 ? 4 : strsize; size += strsize < 4 ? 4 : strsize;
strsize = strnlen(this->mask, 32)+3 & ~3; strsize = strlen(this->mask)+3 & ~3;
size += strsize < 4 ? 4 : strsize; size += strsize < 4 ? 4 : strsize;
size += 12 + this->streamGetPluginSize(); size += 12 + this->streamGetPluginSize();
return size; return size;