Moved source files to src/
This commit is contained in:
@@ -1,59 +1,14 @@
|
||||
#NOTE: I know it's a wonky spot, sue me
|
||||
OUTDIR=out
|
||||
|
||||
all: $(OUTDIR)
|
||||
$(MAKE) -C src
|
||||
|
||||
debug: export CXXFLAGS+=-g
|
||||
debug: clean all
|
||||
|
||||
#include directories
|
||||
INCLUDES+=. common libmap
|
||||
|
||||
#libraries
|
||||
#the order of the $(LIBS) is important, at least for MinGW
|
||||
LIBS+=libcommon.a libmap.a
|
||||
ifeq ($(OS),Windows_NT)
|
||||
LIBS+=-lmingw32
|
||||
endif
|
||||
LIBS+=-lSDL2main -lSDL2 -lSDL2_image -llua
|
||||
ifeq ($(shell uname), Linux)
|
||||
#I don't know what this does, but Ubuntu needs it (dynamic linking for lua)
|
||||
LIBS+=-ldl
|
||||
endif
|
||||
|
||||
#flags
|
||||
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))
|
||||
ifeq ($(shell uname), Linux)
|
||||
#read data about the current install
|
||||
CXXFLAGS+=$(shell sdl-config --cflags --static-libs)
|
||||
endif
|
||||
|
||||
#source
|
||||
CXXSRC=$(wildcard *.cpp)
|
||||
|
||||
#objects
|
||||
OBJDIR=obj
|
||||
OBJ+=$(addprefix $(OBJDIR)/,$(CXXSRC:.cpp=.o))
|
||||
|
||||
#output
|
||||
OUTDIR=out
|
||||
OUT=$(addprefix $(OUTDIR)/,map)
|
||||
|
||||
#targets
|
||||
all: $(OBJ) $(OUT)
|
||||
$(MAKE) -C common
|
||||
$(MAKE) -C libmap
|
||||
$(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIBS)
|
||||
|
||||
$(OBJ): | $(OBJDIR)
|
||||
|
||||
$(OUT): | $(OUTDIR)
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
$(OUTDIR):
|
||||
mkdir $(OUTDIR)
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
$(RM) *.o *.a *.exe
|
||||
|
||||
@@ -104,7 +104,7 @@ static int unloadRegion(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//TODO: check that parameters are not null
|
||||
//TODO: (1) check that parameters are not null
|
||||
|
||||
static int setOnLoad(lua_State* L) {
|
||||
RegionPagerLua* pager = reinterpret_cast<RegionPagerLua*>(lua_touserdata(L, 1));
|
||||
@@ -28,7 +28,7 @@ RegionPagerBase::~RegionPagerBase() {
|
||||
UnloadAll();
|
||||
};
|
||||
|
||||
//TODO: add nullptr checks to the calls to GetRegion()
|
||||
//TODO: (1) add nullptr checks to the calls to GetRegion()
|
||||
|
||||
Region::type_t RegionPagerBase::SetTile(int x, int y, int z, Region::type_t v) {
|
||||
Region* ptr = GetRegion(x, y);
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
void DrawRegionTo(SDL_Renderer* const renderer, Region* const region, int camX, int camY, double scaleX = 1.0, double scaleY = 1.0);
|
||||
|
||||
//accessors
|
||||
//DOCS: reuse Image::clip for tile sizes
|
||||
//DOCS: Reuse Image::clip for tile sizes
|
||||
int GetCountX() { return countX; }
|
||||
int GetCountY() { return countY; }
|
||||
int GetTileW() { return clip.w; }
|
||||
@@ -0,0 +1,62 @@
|
||||
#include directories
|
||||
INCLUDES+=. common libmap
|
||||
|
||||
#libraries
|
||||
#the order of the $(LIBS) is important, at least for MinGW
|
||||
LIBS+=libcommon.a libmap.a
|
||||
ifeq ($(OS),Windows_NT)
|
||||
LIBS+=-lmingw32
|
||||
endif
|
||||
LIBS+=-lSDL2main -lSDL2 -lSDL2_image -llua
|
||||
ifeq ($(shell uname), Linux)
|
||||
#I don't know what this does, but Ubuntu needs it (dynamic linking for lua)
|
||||
LIBS+=-ldl
|
||||
endif
|
||||
|
||||
#flags
|
||||
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))
|
||||
ifeq ($(shell uname), Linux)
|
||||
#read data about the current install
|
||||
CXXFLAGS+=$(shell sdl-config --cflags --static-libs)
|
||||
endif
|
||||
|
||||
#source
|
||||
CXXSRC=$(wildcard *.cpp)
|
||||
|
||||
#objects
|
||||
OBJDIR=obj
|
||||
OBJ+=$(addprefix $(OBJDIR)/,$(CXXSRC:.cpp=.o))
|
||||
|
||||
#output
|
||||
OUTDIR=../out
|
||||
OUT=$(addprefix $(OUTDIR)/,map)
|
||||
|
||||
#targets
|
||||
all: $(OBJ) $(OUT)
|
||||
$(MAKE) -C common
|
||||
$(MAKE) -C libmap
|
||||
$(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIBS)
|
||||
|
||||
$(OBJ): | $(OBJDIR)
|
||||
|
||||
$(OUT): | $(OUTDIR)
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
$(OUTDIR):
|
||||
mkdir $(OUTDIR)
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
$(RM) *.o *.a *.exe
|
||||
else ifeq ($(shell uname), Linux)
|
||||
find . -type f -name '*.o' -exec rm -f -r -v {} \;
|
||||
find . -type f -name '*.a' -exec rm -f -r -v {} \;
|
||||
rm -f -v $(OUT)
|
||||
endif
|
||||
|
||||
rebuild: clean all
|
||||
Reference in New Issue
Block a user