completely switch build system to scons
This commit is contained in:
parent
cf3a986b49
commit
0579235c93
142
Makefile
142
Makefile
@ -1,139 +1,15 @@
|
|||||||
|
export SCONSFLAGS := -Q
|
||||||
|
|
||||||
install_dir ?= $(HOME)/local/anaglym
|
.PHONY: all dist install clean
|
||||||
WINCHECK := $(shell which msys-1.0.dll >/dev/null 2>&1; if [ $$? -eq 0 ]; then echo MSYS; fi)
|
|
||||||
ifeq ($(strip $(WINCHECK)),)
|
|
||||||
PLATFORM := PLATFORM_LINUX
|
|
||||||
else
|
|
||||||
PLATFORM := PLATFORM_WINDOWS
|
|
||||||
endif
|
|
||||||
|
|
||||||
TARGET := anaglym
|
all:
|
||||||
SUBDIRS := WFObj PhyObj TextureCache OdeWorld
|
@scons
|
||||||
SUBDIR_OBJS := $(foreach sd,$(SUBDIRS),$(sd)/$(sd).o)
|
|
||||||
CXXOBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
|
|
||||||
CXXOBJS := $(patsubst ag_lua.o,,$(CXXOBJS))
|
|
||||||
CXXOBJS := $(patsubst sdl_keymap.o,,$(CXXOBJS))
|
|
||||||
OBJS := $(CXXOBJS) $(SUBDIR_OBJS) ag_lua.o sdl_keymap.o
|
|
||||||
CXXDEPS := $(CXXOBJS:.o=.dep)
|
|
||||||
DEPS := $(CDEPS) $(CXXDEPS)
|
|
||||||
DEPS := $(patsubst ag_lua.dep,,$(DEPS))
|
|
||||||
DEPS := $(patsubst sdl_keymap.dep,,$(DEPS))
|
|
||||||
|
|
||||||
LUAINCLUDE := $(shell pkg-config --cflags lua5.1 2>/dev/null)
|
dist:
|
||||||
ifeq ($(strip $(LUAINCLUDE)),)
|
@scons $@
|
||||||
LUAINCLUDE := $(shell which lua-config >/dev/null 2>&1; if [ $$? -eq 0 ]; then lua-config --include; fi)
|
|
||||||
endif
|
|
||||||
ifeq ($(strip $(LUAINCLUDE)),)
|
|
||||||
LUAINCLUDE := -I/usr/include/lua5.1
|
|
||||||
endif
|
|
||||||
|
|
||||||
LUALIBS := $(shell pkg-config --libs lua5.1 2>/dev/null)
|
install:
|
||||||
ifeq ($(strip $(LUALIBS)),)
|
@scons $@
|
||||||
LUALIBS := $(shell which lua-config >/dev/null 2>&1; if [ $$? -eq 0 ]; then lua-config --libs; fi)
|
|
||||||
endif
|
|
||||||
ifeq ($(strip $(LUALIBS)),)
|
|
||||||
LUALIBS := -llua5.1
|
|
||||||
endif
|
|
||||||
|
|
||||||
FTGLINCLUDE := $(shell pkg-config --cflags ftgl)
|
|
||||||
FTGLLIBS := $(shell pkg-config --libs ftgl)
|
|
||||||
|
|
||||||
SDLINCLUDE := $(shell sdl-config --cflags)
|
|
||||||
SDLLIBS := -lSDL_image -lSDL_sound $(shell sdl-config --libs)
|
|
||||||
|
|
||||||
ODEINCLUDE := $(shell ode-config --cflags)
|
|
||||||
ODELIBS := $(shell ode-config --libs)
|
|
||||||
|
|
||||||
SMPEGLIBS := $(shell smpeg-config --libs)
|
|
||||||
|
|
||||||
VORBISLIBS := -lvorbisfile
|
|
||||||
|
|
||||||
TOPLEVEL := $(shell pwd)
|
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WINDOWS)
|
|
||||||
GLLIBS := -lopengl32 -lglu32
|
|
||||||
WINDOWSLIBS := -lmingw32
|
|
||||||
TARGET := $(TARGET).exe
|
|
||||||
CC := gcc
|
|
||||||
else
|
|
||||||
GLLIBS := -lGL -lGLU
|
|
||||||
endif
|
|
||||||
|
|
||||||
export CPPFLAGS := $(LUAINCLUDE) $(SDLINCLUDE) $(ODEINCLUDE) $(FTGLINCLUDE) -I$(TOPLEVEL) -D$(PLATFORM)
|
|
||||||
export CFLAGS := $(CPPFLAGS) -O2 -Wall
|
|
||||||
export CXXFLAGS := $(CFLAGS)
|
|
||||||
export LDFLAGS := $(LUALIBS) $(ODELIBS) $(GLLIBS) $(WINDOWSLIBS) $(SDLLIBS) $(FTGLLIBS) $(SMPEGLIBS) $(VORBISLIBS)
|
|
||||||
|
|
||||||
ifdef DEBUG
|
|
||||||
CFLAGS += -g
|
|
||||||
CXXFLAGS += -g
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(TARGET)
|
|
||||||
|
|
||||||
$(TARGET): $(OBJS)
|
|
||||||
$(CXX) -o $@ $^ $(LDFLAGS)
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
|
|
||||||
|
|
||||||
%.o: %.cc
|
|
||||||
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
|
|
||||||
|
|
||||||
ag_lua.cc: ag.lua
|
|
||||||
xxd -i $< > $@
|
|
||||||
|
|
||||||
ag_lua.o: ag_lua.cc
|
|
||||||
|
|
||||||
sdl_keymap.o: sdl_keymap.cc
|
|
||||||
|
|
||||||
sdl_keymap.cc: gen-sdl-keymap.pl
|
|
||||||
perl $<
|
|
||||||
|
|
||||||
# Make dependency files
|
|
||||||
%.dep: %.c
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CC) -MM $(CPPFLAGS) $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@
|
|
||||||
|
|
||||||
%.dep: %.cc
|
|
||||||
@set -e; rm -f $@; \
|
|
||||||
$(CXX) -MM $(CPPFLAGS) $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@
|
|
||||||
|
|
||||||
.PHONY: dist
|
|
||||||
dist: all
|
|
||||||
-rm -rf $@
|
|
||||||
-mkdir -p $@
|
|
||||||
cp -a lib $@/lib
|
|
||||||
cp -a doc $@/doc
|
|
||||||
cp $(TARGET) $@
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WINDOWS)
|
|
||||||
# copy DLLs to distribution directory
|
|
||||||
cp -a $(shell which SDL.dll) $@
|
|
||||||
cp -a $(shell which SDL_image.dll) $@
|
|
||||||
# jh 2009-10-29 statically linking with ODE now
|
|
||||||
# cp -a $(shell which ODE.dll) $@
|
|
||||||
cp -a $(shell which jpeg.dll) $@
|
|
||||||
cp -a $(shell which libpng12-0.dll) $@
|
|
||||||
cp -a $(shell which zlib1.dll) $@
|
|
||||||
cp -a $(shell which libtiff-3.dll) $@
|
|
||||||
cp -a $(shell which libftgl-2.dll) $@
|
|
||||||
cp -a $(shell which lua5.1.dll) $@
|
|
||||||
cp -a $(shell which freetype6.dll) $@
|
|
||||||
cp -a $(shell which libogg-0.dll) $@
|
|
||||||
cp -a $(shell which libvorbis-0.dll) $@
|
|
||||||
cp -a $(shell which libvorbisfile-3.dll) $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install: dist
|
|
||||||
@echo "Installing to '$(install_dir)', override with 'make install_dir=path'"
|
|
||||||
-mkdir -p $(install_dir)
|
|
||||||
rsync -av dist/ $(install_dir)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f $(OBJS) $(DEPS) $(TARGET) stdout.txt stderr.txt sdl_keymap.cc ag_lua.cc
|
@scons -c dist
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm -rf dist
|
|
||||||
|
|
||||||
-include $(DEPS)
|
|
||||||
|
@ -97,3 +97,5 @@ if platform == 'PLATFORM_WINDOWS':
|
|||||||
env.Install('dist', bt('which libogg-0.dll'))
|
env.Install('dist', bt('which libogg-0.dll'))
|
||||||
env.Install('dist', bt('which libvorbis-0.dll'))
|
env.Install('dist', bt('which libvorbis-0.dll'))
|
||||||
env.Install('dist', bt('which libvorbisfile-3.dll'))
|
env.Install('dist', bt('which libvorbisfile-3.dll'))
|
||||||
|
|
||||||
|
env.Clean('dist', 'dist')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user