diff --git a/Makefile.am b/Makefile.am index f37149d2..816663bc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,3 @@ -AM_CPPFLAGS = ${HOST_CFLAGS} -DUSE_SOCKETS -DSCALE -I${top_srcdir}/src \ - ${SDL_CFLAGS} ${LIBMODPLUG_CFLAGS} ${LIBXMP_CFLAGS} ${ZLIB_CFLAGS} -AM_CFLAGS = -Wall -AM_CXXFLAGS = -Wall - dist_pkgdata_DATA = openjazz.000 EXTRA_DIST = gpl.txt licenses.txt README.md @@ -14,6 +9,23 @@ appicon_fallbackdir = $(datadir)/icons/hicolor/48x48/apps dist_appicon_fallback_DATA = unix/OpenJazz.png bin_PROGRAMS = OpenJazz +OpenJazz_CPPFLAGS = \ + -DUSE_SOCKETS \ + -DSCALE \ + -I${srcdir}/src +OpenJazz_CXXFLAGS = \ + ${HOST_CFLAGS} \ + ${SDL_CFLAGS} \ + ${LIBMODPLUG_CFLAGS} \ + ${LIBXMP_CFLAGS} \ + ${ZLIB_CFLAGS} +OpenJazz_LDADD = \ + ${SDL_LIBS} \ + ${LIBMODPLUG_LIBS} \ + ${LIBXMP_LIBS} \ + ${ZLIB_LIBS} \ + ${NET_LIBS} \ + ${HOST_LIBS} OpenJazz_SOURCES = \ src/game/clientgame.cpp \ src/game/game.cpp \ @@ -113,5 +125,3 @@ OpenJazz_SOURCES = \ src/setup.h \ src/util.cpp \ src/util.h - -OpenJazz_LDADD = ${SDL_LIBS} ${LIBMODPLUG_LIBS} ${LIBXMP_LIBS} ${ZLIB_LIBS} ${NET_LIBS} ${HOST_LIBS} diff --git a/Makefile.gameshell b/Makefile.gameshell deleted file mode 100755 index 0f3453de..00000000 --- a/Makefile.gameshell +++ /dev/null @@ -1,35 +0,0 @@ -PREFIX = /usr -TOOLS = bin -TARGET = -INCLUDE = $(PREFIX)/include -LIBRARY = $(PREFIX)/lib/arm-linux-gnueabihf - -# OpenJazz makefile -include openjazz.mk - -# Sane defaults -CXX ?= g++ -CXXFLAGS ?= -g -Wall -O2 - -CXXFLAGS += -DGAMESHELL - -# to enable libmodplug install the dev package -# apt-get update -# apt-get install libmodplug-dev -CXXFLAGS += -DUSE_MODPLUG -I$(INCLUDE)/libmodplug -LDFLAGS += $(LIBRARY)/libmodplug.so - -# SDL -CXXFLAGS += $(shell sdl-config --cflags) -LIBS += $(shell sdl-config --libs) - -LIBS += -lm -lz - -OpenJazz: $(OBJS) - $(CXX) -o OpenJazz $(LDFLAGS) $(OBJS) $(LIBS) - -%.o: %.cpp - $(CXX) $(CXXFLAGS) -Isrc -c $< -o $@ - -clean: - rm -f OpenJazz $(OBJS) diff --git a/configure.ac b/configure.ac index 7b0ca159..d1bb7c58 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,14 @@ AC_INIT([openjazz], [0], [https://github.com/AlisterT/openjazz/issues], [openjazz], [http://www.alister.eu/jazz/oj/]) + AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax no-dist-gzip dist-xz]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + AC_CANONICAL_HOST AC_PROG_CXX +AC_PROG_CXXCPP PKG_PROG_PKG_CONFIG + PKG_CHECK_MODULES([SDL], [sdl]) PKG_CHECK_MODULES([LIBXMP], [libxmp], [AC_DEFINE(USE_XMP, [1], [Enable XMP Music])], [ PKG_CHECK_MODULES([LIBMODPLUG], [libmodplug], [AC_DEFINE(USE_MODPLUG, [1], [Enable ModPlug Music])], [ @@ -12,16 +16,25 @@ PKG_CHECK_MODULES([LIBXMP], [libxmp], [AC_DEFINE(USE_XMP, [1], [Enable XMP Music ]) ]) PKG_CHECK_MODULES([ZLIB], [zlib]) + AS_CASE([$host], - [*-*-mingw*], [NET_LIBS="-lws2_32"], - [*-haiku*], [HOST_CFLAGS="-D_BSD_SOURCE" HOST_LIBS="-lbe" NET_LIBS="-lnetwork"], - [arm-none-linux-gnueabi], [HOST_CFLAGS="-DPANDORA -fsigned-char" HOST_LIBS="-lts"], - [arm-gph-linux-gnueabi], [HOST_CFLAGS="-DCAANOO -fsigned-char"], - [arm-openwiz-linux-gnu], [HOST_CFLAGS="-DWIZ -fsigned-char"], - [arm-open2x-linux], [HOST_CFLAGS="-DGP2X -fsigned-char"], - [mipsel-linux*], [HOST_CFLAGS="-DDINGOO"]) + [*-*-mingw*], [NET_LIBS="-lws2_32" OJ_HOST="MinGW (Windows)"], + [*-haiku*], [HOST_CFLAGS="-D_BSD_SOURCE" HOST_LIBS="-lbe" NET_LIBS="-lnetwork" OJ_HOST="Haiku"], + [arm-none-linux-gnueabi], [HOST_CFLAGS="-DPANDORA -fsigned-char" HOST_LIBS="-lts" OJ_HOST="Pandora"], + [arm-gph-linux-gnueabi], [HOST_CFLAGS="-DCAANOO -fsigned-char" OJ_HOST="GP2X Caanoo"], + [arm-openwiz-linux-gnu], [HOST_CFLAGS="-DWIZ -fsigned-char" OJ_HOST="GP2X Wiz"], + [arm-open2x-linux], [HOST_CFLAGS="-DGP2X -fsigned-char" OJ_HOST="GP2X"], + [mipsel-linux*], [HOST_CFLAGS="-DDINGOO" OJ_HOST="Dingoo"], + [armv7l-unknown-linux-gnueabihf], [HOST_CFLAGS="-DGAMESHELL" OJ_HOST="GameShell"]) AC_SUBST(HOST_CFLAGS) AC_SUBST(HOST_LIBS) AC_SUBST(NET_LIBS) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT + +AS_IF([test "x$OJ_HOST" != "x"],[ + echo "" + echo "Detected Platform: $OJ_HOST. If this is wrong, please open a bug report!" + echo "" +])