makefile cleanup

This commit is contained in:
ehouse 2006-02-17 07:27:36 +00:00
parent 472b61dbe3
commit 5aeb5dc6fa
3 changed files with 45 additions and 37 deletions

View file

@ -1,5 +1,5 @@
# -*- mode: Makefile; -*- # -*- mode: Makefile; -*-
clean: clean:
rm -rf $(PLATFORM)/*.o rm -rf $(PLATFORM)

View file

@ -20,12 +20,12 @@ all: $(TARGET)
# Rule for (xplatform) objfiles in this directory # Rule for (xplatform) objfiles in this directory
$(COMMONOBJDIR)/%.o: ../common/%.c $(COMMONOBJDIR)/%.o: ../common/%.c
ls -d $(COMMONOBJDIR) || mkdir $(COMMONOBJDIR) mkdir -p $(COMMONOBJDIR)
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) -DPLATFORM=$(PLATFORM) \ $(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) -DPLATFORM=$(PLATFORM) \
$< -o $@ $< -o $@
# Rule for single-platform objfiles in directory of including Makefile # Rule for single-platform objfiles in directory of including Makefile
$(PLATFORM)/%.o: %.c $(PLATFORM)/%.o: %.c
ls -d $(PLATFORM) || mkdir $(PLATFORM) mkdir -p $(PLATFORM)
$(CC) -c -dD $(CFLAGS) $(INCLUDES) $(DEFINES) -DPLATFORM=$(PLATFORM) $< -o $@ $(CC) -c -dD $(CFLAGS) $(INCLUDES) $(DEFINES) -DPLATFORM=$(PLATFORM) $< -o $@

View file

@ -15,20 +15,44 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
PLATFORM=linux ifeq ($(MEMDEBUG),TRUE)
DEFINES = -DMEM_DEBUG -DDEBUG
CFLAGS += -g $(GPROFFLAG)
CFLAGS += -DDEBUG_TS
PLATFORM = obj_linux_memdbg
else
DEFINES =
PLATFORM = obj_linux_rel
CFLAGS += -Os
endif
DO_CURSES = -DPLATFORM_NCURSES
DO_GTK = -DPLATFORM_GTK
ifdef CURSES_ONLY
DO_GTK =
# := avoids recursion
PLATFORM := $(PLATFORM)_curses
endif
ifdef GTK_ONLY
DO_CURSES =
PLATFORM := $(PLATFORM)_gtk
endif
DEFINES += $(DO_CURSES) $(DO_GTK)
TARGET=$(PLATFORM)/xwords TARGET=$(PLATFORM)/xwords
CC = gcc CC = gcc
include ../common/config.mk include ../common/config.mk
DEFINES = -DPLATFORM_LINUX -DKEY_SUPPORT -DKEYBOARD_NAV -DNODE_CAN_4 DEFINES += -DPLATFORM_LINUX -DKEY_SUPPORT -DKEYBOARD_NAV -DNODE_CAN_4
DEFINES += -DSTUBBED_DICT DEFINES += -DSTUBBED_DICT
ifdef DO_GTK
DEFINES += -DXWFEATURE_SEARCHLIMIT DEFINES += -DXWFEATURE_SEARCHLIMIT
endif
DEFINES += -DFEATURE_TRAY_EDIT DEFINES += -DFEATURE_TRAY_EDIT
# build with GTK
DEFINES += -DPLATFORM_GTK
# build with ncurses (-u flag chooses over gtk if both present)
DEFINES += -DPLATFORM_NCURSES
#DEFINES += -DDRAW_WITH_PRIMITIVES #DEFINES += -DDRAW_WITH_PRIMITIVES
DEFINES += -DBEYOND_IR DEFINES += -DBEYOND_IR
@ -36,12 +60,12 @@ DEFINES += -DBEYOND_IR
#DEFINES += -DFEATURE_TRAY_EDIT #DEFINES += -DFEATURE_TRAY_EDIT
DEFINES += -DDONT_ABORT_ENGINE DEFINES += -DDONT_ABORT_ENGINE
#-DDEBUG -DEIGHT_TILES #-DDEBUG -DEIGHT_TILES
#GPROFFLAG = -pg #GPROFFLAG = -pg
# INCLUDES += -I/usr/lib/glib/include # INCLUDES += -I/usr/lib/glib/include
INCLUDES += -I$(HOME)/usr/local/include/ -I/home/ehouse/usr/local/lib/glib/include -I$(HOME)/usr/local/pilot/include
OBJ = $(PLATFORM)/linuxmain.o \ OBJ = $(PLATFORM)/linuxmain.o \
$(PLATFORM)/linuxdict.o \ $(PLATFORM)/linuxdict.o \
@ -62,13 +86,10 @@ OBJ = $(PLATFORM)/linuxmain.o \
# $(PLATFORM)/linuxcommpipe.o \ # $(PLATFORM)/linuxcommpipe.o \
LIBS = -lm -L $(HOME)/usr/local/pilot/lib $(GPROFFLAG) LIBS = -lm -L $(HOME)/usr/local/pilot/lib $(GPROFFLAG)
# -lprc
# -pg
gtkCFLAGS = -g -Wall $(GPROFFLAG)
ifneq (,$(findstring DPLATFORM_GTK,$(DEFINES))) ifneq (,$(findstring DPLATFORM_GTK,$(DEFINES)))
LIBS += `pkg-config --libs gtk+-2.0` LIBS += `pkg-config --libs gtk+-2.0`
CFLAGS += `pkg-config --cflags gtk+-2.0` -DPOINTER_SUPPORT $(gtkCFLAGS) \ CFLAGS += `pkg-config --cflags gtk+-2.0` -DPOINTER_SUPPORT \
-DGDK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED
endif endif
@ -76,16 +97,11 @@ ifneq (,$(findstring DPLATFORM_NCURSES,$(DEFINES)))
LIBS += -lncurses LIBS += -lncurses
endif endif
ifeq (,$(findstring -DCLIENT_ONLY,$(DEFINES)))
# LIBS += -lprc
endif
# provides an all: target # provides an all: target
include ../common/rules.mk include ../common/rules.mk
help: help:
@echo -n "make debug | curses_debug | gtk_debug | " @echo "make [MEMDEBUG=TRUE] [CURSES_ONLY=TRUE] [GTK_ONLY=TRUE]"
@echo "curses_client_debug | gtk_client_debug"
#test: #test:
# $(MAKE) test1 DEFINES="$(DEFINES) -FOOBAR" # $(MAKE) test1 DEFINES="$(DEFINES) -FOOBAR"
@ -94,33 +110,25 @@ help:
# echo $(findstring FOO,$(DEFINES)) # echo $(findstring FOO,$(DEFINES))
# echo $(DEFINES) # echo $(DEFINES)
curses_client_debug: curses:
$(MAKE) $(TARGET) DEFINES="$(DEFINES) -DDEBUG -DPLATFORM_NCURSES -DCLIENT_ONLY" $(MAKE) CURSES_ONLY=TRUE
curses_debug: gtk:
$(MAKE) $(TARGET) DEFINES="$(DEFINES) -DDEBUG -DPLATFORM_NCURSES" $(MAKE) GTK_ONLY=TRUE
gtk_client_debug:
$(MAKE) $(TARGET) DEFINES="$(DEFINES) -DDEBUG -DPLATFORM_GTK -DCLIENT_ONLY"
gtk_debug:
$(MAKE) $(TARGET) DEFINES="$(DEFINES) -DDEBUG -DPLATFORM_GTK"
debug:
$(MAKE) $(TARGET) DEFINES="$(DEFINES) -DDEBUG -DPLATFORM_NCURSES -DPLATFORM_GTK"
memdebug: memdebug:
$(MAKE) $(TARGET) DEFINES="$(DEFINES) -DDEBUG -DPLATFORM_NCURSES -DPLATFORM_GTK -DMEM_DEBUG" $(MAKE) MEMDEBUG=TRUE
gprof: gprof:
$(MAKE) $(TARGET) GPROFFLAG=-pg DEFINES="$(DEFINES) -DPLATFORM_NCURSES -DPLATFORM_GTK" $(MAKE) GPROFFLAG=-pg MEMDEBUG=TRUE
$(TARGET): $(COMMONOBJ) $(OBJ) *.h Makefile $(TARGET): $(COMMONOBJ) $(OBJ) *.h Makefile
@ls -d $(PLATFORM) >/dev/null || mkdir $(PLATFORM) mkdir -p $(PLATFORM)
$(CC) $(CFLAGS) $(DEFINES) $(COMMONOBJ) $(OBJ) $(LIBS) -o $@ $(CC) $(CFLAGS) $(DEFINES) $(COMMONOBJ) $(OBJ) $(LIBS) -o $@
$(PLATFORM)/%.o: %.c $(PLATFORM)/%.o: %.c
@ls -d $(PLATFORM) >/dev/null || mkdir $(PLATFORM) mkdir -p $(PLATFORM)
$(CC) -c $(INCLUDES) $(DEFINES) -DPLATFORM=$(PLATFORM) $(CFLAGS) $< -o $@ $(CC) -c $(INCLUDES) $(DEFINES) -DPLATFORM=$(PLATFORM) $(CFLAGS) $< -o $@
clean: clean: