xwords/xwords4/linux/Makefile

214 lines
5.3 KiB
Makefile
Raw Normal View History

# -*- mode: makefile; compile-command: "make -j MEMDEBUG=TRUE"; -*-
# Copyright 2002-2007 by Eric House (xwords@eehouse.org). All rights
# reserved.
2003-11-01 06:35:29 +01:00
#
# 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.
2006-02-17 08:27:36 +01:00
ifeq ($(MEMDEBUG),TRUE)
DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING -DNUMBER_KEY_AS_INDEX
2008-02-16 20:05:30 +01:00
CFLAGS += -g $(GPROFFLAG) -Wall -Wunused-parameter -Wcast-align -Werror
2006-02-17 08:27:36 +01:00
CFLAGS += -DDEBUG_TS
PLATFORM = obj_linux_memdbg
else
DEFINES =
PLATFORM = obj_linux_rel
CFLAGS += -Os -Werror -Wunused
2006-02-17 08:27:36 +01:00
endif
DO_CURSES = -DPLATFORM_NCURSES
ifdef CURSES_SMALL_SCREEN
DO_CURSES += -DCURSES_SMALL_SCREEN
endif
2006-02-17 08:27:36 +01:00
DO_GTK = -DPLATFORM_GTK
SVN_REV ?= "$(shell svnversion -n .)"
SVNDEF = -D'SVN_REV=$(SVN_REV)'
2006-02-17 08:27:36 +01:00
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
2006-02-17 08:27:36 +01:00
DEFINES += $(DO_CURSES) $(DO_GTK) $(SVNDEF)
2006-02-17 08:27:36 +01:00
ifdef LIB_NO_UI
TARGET=$(PLATFORM)/libxwords.so.0
2008-08-30 15:28:53 +02:00
POINTER_SUPPORT = -DPOINTER_SUPPORT
else
2003-11-01 06:35:29 +01:00
TARGET=$(PLATFORM)/xwords
endif
2006-02-17 08:27:36 +01:00
2003-11-01 06:35:29 +01:00
include ../common/config.mk
2006-02-17 08:27:36 +01:00
DEFINES += -DPLATFORM_LINUX -DKEY_SUPPORT -DKEYBOARD_NAV -DNODE_CAN_4
# DEFINES += -DSTUBBED_DICT
2006-02-17 08:27:36 +01:00
ifdef DO_GTK
2004-06-27 07:03:48 +02:00
DEFINES += -DXWFEATURE_SEARCHLIMIT
2006-02-17 08:27:36 +01:00
endif
2004-06-27 07:03:48 +02:00
DEFINES += -DFEATURE_TRAY_EDIT
2003-11-01 06:35:29 +01:00
#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
2006-02-17 08:27:36 +01:00
2003-11-01 06:35:29 +01:00
#-DDEBUG -DEIGHT_TILES
#GPROFFLAG = -pg
# INCLUDES += -I/usr/lib/glib/include
INCLUDES += ${EXTRAINCS}
2003-11-01 06:35:29 +01:00
ifdef DO_GTK
GTK_OBJS = \
2003-11-01 06:35:29 +01:00
$(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 = \
2003-11-01 06:35:29 +01:00
$(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 = \
2003-11-01 06:35:29 +01:00
$(PLATFORM)/filestream.o \
$(PLATFORM)/linuxbt.o \
$(PLATFORM)/linuxudp.o \
$(PLATFORM)/linuxdict.o \
$(PLATFORM)/linuxutl.o \
$(CURSES_OBJS) $(GTK_OBJS) $(MAIN_OBJS)
2003-11-01 06:35:29 +01:00
LIBS = -lm -lmcheck $(GPROFFLAG)
ifdef BLUETOOTH
LIBS += -lbluetooth
endif
2003-11-01 06:35:29 +01:00
ifneq (,$(findstring DPLATFORM_GTK,$(DEFINES)))
2005-05-29 22:40:38 +02:00
LIBS += `pkg-config --libs gtk+-2.0`
2008-08-30 15:28:53 +02:00
CFLAGS += `pkg-config --cflags gtk+-2.0` \
2005-05-29 22:40:38 +02:00
-DGDK_DISABLE_DEPRECATED
2008-08-30 15:28:53 +02:00
POINTER_SUPPORT = -DPOINTER_SUPPORT
2003-11-01 06:35:29 +01:00
endif
2008-08-30 15:28:53 +02:00
CFLAGS += $(POINTER_SUPPORT)
2003-11-01 06:35:29 +01:00
ifneq (,$(findstring DPLATFORM_NCURSES,$(DEFINES)))
LIBS += $(OE_LIBDIR) -lncurses
2003-11-01 06:35:29 +01:00
endif
# provides an all: target
include ../common/rules.mk
all: $(TARGET)
2003-11-01 06:35:29 +01:00
help:
2006-02-17 08:27:36 +01:00
@echo "make [MEMDEBUG=TRUE] [CURSES_ONLY=TRUE] [GTK_ONLY=TRUE]"
2003-11-01 06:35:29 +01:00
#test:
# $(MAKE) test1 DEFINES="$(DEFINES) -FOOBAR"
#test1:
# echo $(findstring FOO,$(DEFINES))
# echo $(DEFINES)
2006-02-17 08:27:36 +01:00
curses:
$(MAKE) CURSES_ONLY=TRUE
2003-11-01 06:35:29 +01:00
2006-02-17 08:27:36 +01:00
gtk:
$(MAKE) GTK_ONLY=TRUE
2003-11-01 06:35:29 +01:00
memdebug:
2006-02-17 08:27:36 +01:00
$(MAKE) MEMDEBUG=TRUE
2003-11-01 06:35:29 +01:00
gprof:
2006-02-17 08:27:36 +01:00
$(MAKE) GPROFFLAG=-pg MEMDEBUG=TRUE
2003-11-01 06:35:29 +01:00
$(PLATFORM)/xwords: $(COMMONOBJ) $(OBJ) *.h Makefile
2006-02-17 08:27:36 +01:00
mkdir -p $(PLATFORM)
2003-11-01 06:35:29 +01:00
$(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
2003-11-01 06:35:29 +01:00
$(PLATFORM)/%.o: %.c
2006-02-17 08:27:36 +01:00
mkdir -p $(PLATFORM)
2003-11-01 06:35:29 +01:00
$(CC) -c $(INCLUDES) $(DEFINES) -DPLATFORM=$(PLATFORM) $(CFLAGS) $< -o $@
clean:
2006-02-27 01:08:32 +01:00
rm -rf $(PLATFORM)/*.o $(TARGET) $(DESTDIR)/usr/local/bin/xwords
2003-11-01 06:35:29 +01:00
cd ../common && $(MAKE) PLATFORM=$(PLATFORM) $@
2006-02-27 01:08:32 +01:00
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