xwords/xwords4/linux/Makefile
ehouse a6ecdd0f9e merge revisions 2443 2446 2447 2450 2451 2452 2454 2456 2469 2498 2499
2509 2513 2514 2515 2516 2517 2518 2519 2521 2522 2523 2524 2525 2526
2527 2528 2529 2530 2531 2532 2534 2535 2536 2537 2538 2539 2540 2541
2542 2543 and 2544 from trunk with the goal of adding localization
support to this branch so that it can be released before all the
networking stuff on trunk is debugged.
2009-05-09 16:01:44 +00:00

213 lines
5.3 KiB
Makefile

# -*- mode: makefile; compile-command: "make -j3 MEMDEBUG=TRUE"; -*-
# Copyright 2002-2007 by Eric House (xwords@eehouse.org). All rights
# reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
ifeq ($(MEMDEBUG),TRUE)
DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING -DNUMBER_KEY_AS_INDEX
CFLAGS += -g $(GPROFFLAG) -Wall -Wunused-parameter -Wcast-align -Werror
CFLAGS += -DDEBUG_TS
PLATFORM = obj_linux_memdbg
else
DEFINES =
PLATFORM = obj_linux_rel
CFLAGS += -Os -Werror -Wunused
endif
DO_CURSES = -DPLATFORM_NCURSES
ifdef CURSES_SMALL_SCREEN
DO_CURSES += -DCURSES_SMALL_SCREEN
endif
DO_GTK = -DPLATFORM_GTK
SVN_REV ?= "$(shell svnversion -n .)"
SVNDEF = -D'SVN_REV=$(SVN_REV)'
ifdef CURSES_ONLY
DO_GTK =
# := avoids recursion
PLATFORM := $(PLATFORM)_curses
endif
ifdef GTK_ONLY
DO_CURSES =
PLATFORM := $(PLATFORM)_gtk
endif
ifdef LIB_NO_UI
DO_CURSES =
DO_GTK =
endif
DEFINES += $(DO_CURSES) $(DO_GTK) $(SVNDEF)
ifdef LIB_NO_UI
TARGET=$(PLATFORM)/libxwords.so.0
POINTER_SUPPORT = -DPOINTER_SUPPORT
else
TARGET=$(PLATFORM)/xwords
endif
include ../common/config.mk
DEFINES += -DPLATFORM_LINUX -DKEY_SUPPORT -DKEYBOARD_NAV -DNODE_CAN_4
# DEFINES += -DSTUBBED_DICT
ifdef DO_GTK
DEFINES += -DXWFEATURE_SEARCHLIMIT
endif
DEFINES += -DFEATURE_TRAY_EDIT
#DEFINES += -DDRAW_WITH_PRIMITIVES
ifdef CURSES_CELL_HT
DEFINES += -DCURSES_CELL_HT=$(CURSES_CELL_HT)
endif
ifdef CURSES_CELL_WIDTH
DEFINES += -DCURSES_CELL_WIDTH=$(CURSES_CELL_WIDTH)
endif
# Bluetooth support
ifndef NO_BLUETOOTH
BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_L2CAP
endif
#BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_RFCOMM
# DEFINES += -DXWFEATURE_IR
DEFINES += ${BLUETOOTH}
DEFINES += -DXWFEATURE_RELAY
# Support device-to-device connection via UDP, e.g. using wifi on a
# LAN or where the host/server isn't behind a firewall.
DEFINES += -DXWFEATURE_IP_DIRECT
# Choose one of these. RELAY_HEARTBEAT means relay (must be compiled
# with same -D) works with comms on heartbeat. Works only with relay.
# COMMS_HEARTBEAT should work on any comms transport (even IR, but
# user experience will be very bad!). Is particularly useful with BT.
# DEFINES += -DRELAY_HEARTBEAT
DEFINES += -DCOMMS_HEARTBEAT
# Let users pick the tiles going into their trays
#DEFINES += -DFEATURE_TRAY_EDIT
DEFINES += -DDONT_ABORT_ENGINE
DEFINES += -DPERIMETER_FOCUS
#-DDEBUG -DEIGHT_TILES
#GPROFFLAG = -pg
# INCLUDES += -I/usr/lib/glib/include
INCLUDES += ${EXTRAINCS}
ifdef DO_GTK
GTK_OBJS = \
$(PLATFORM)/gtkmain.o \
$(PLATFORM)/gtkdraw.o \
$(PLATFORM)/gtkask.o \
$(PLATFORM)/gtkletterask.o \
$(PLATFORM)/gtkpasswdask.o \
$(PLATFORM)/gtknewgame.o \
$(PLATFORM)/gtkntilesask.o
endif
ifdef DO_CURSES
CURSES_OBJS = \
$(PLATFORM)/cursesmain.o \
$(PLATFORM)/cursesdraw.o \
$(PLATFORM)/cursesask.o \
$(PLATFORM)/cursesdlgutil.o \
$(PLATFORM)/cursesletterask.o
endif
ifndef LIB_NO_UI
MAIN_OBJS = $(PLATFORM)/linuxmain.o
endif
OBJ = \
$(PLATFORM)/filestream.o \
$(PLATFORM)/linuxbt.o \
$(PLATFORM)/linuxudp.o \
$(PLATFORM)/linuxdict.o \
$(PLATFORM)/linuxutl.o \
$(CURSES_OBJS) $(GTK_OBJS) $(MAIN_OBJS)
LIBS = -lm -lmcheck $(GPROFFLAG)
ifdef BLUETOOTH
LIBS += -lbluetooth
endif
ifneq (,$(findstring DPLATFORM_GTK,$(DEFINES)))
LIBS += `pkg-config --libs gtk+-2.0`
CFLAGS += `pkg-config --cflags gtk+-2.0` \
-DGDK_DISABLE_DEPRECATED
POINTER_SUPPORT = -DPOINTER_SUPPORT
endif
CFLAGS += $(POINTER_SUPPORT)
ifneq (,$(findstring DPLATFORM_NCURSES,$(DEFINES)))
LIBS += $(OE_LIBDIR) -lncursesw
endif
# provides an all: target
include ../common/rules.mk
all: $(TARGET)
help:
@echo "make [MEMDEBUG=TRUE] [CURSES_ONLY=TRUE] [GTK_ONLY=TRUE]"
#test:
# $(MAKE) test1 DEFINES="$(DEFINES) -FOOBAR"
#test1:
# echo $(findstring FOO,$(DEFINES))
# echo $(DEFINES)
curses:
$(MAKE) CURSES_ONLY=TRUE
gtk:
$(MAKE) GTK_ONLY=TRUE
memdebug:
$(MAKE) MEMDEBUG=TRUE
gprof:
$(MAKE) GPROFFLAG=-pg MEMDEBUG=TRUE
$(PLATFORM)/xwords: $(COMMONOBJ) $(OBJ) *.h Makefile
mkdir -p $(PLATFORM)
$(CC) $(CFLAGS) $(DEFINES) $(COMMONOBJ) $(OBJ) $(LIBS) -o $@
$(PLATFORM)/libxwords.so.0: $(COMMONOBJ) $(OBJ) *.h Makefile
mkdir -p $(PLATFORM)
$(CC) $(CFLAGS) $(DEFINES) $(COMMONOBJ) $(OBJ) -shared -o $@ -Wl,-soname,libxwords.so.0
$(PLATFORM)/%.o: %.c
mkdir -p $(PLATFORM)
$(CC) -c $(INCLUDES) $(DEFINES) -DPLATFORM=$(PLATFORM) $(CFLAGS) $< -o $@
clean:
rm -rf $(PLATFORM)/*.o $(TARGET) $(DESTDIR)/usr/local/bin/xwords
cd ../common && $(MAKE) PLATFORM=$(PLATFORM) $@
install: $(TARGET)
cp $< $(DESTDIR)/usr/local/bin
tarball:
tar cvfz xwords_$(shell svnversion ..).tgz \
../linux/Makefile ../linux/*.c ../linux/*.h \
../relay/*.h \
../common/*.c ../common/*.h ../common/rules.mk ../common/config.mk
md5sum xwords_$(shell svnversion ..).tgz > xwords_$(shell svnversion ..).tgz.md5