summaryrefslogtreecommitdiff
path: root/Makefile
blob: 10ff1a5f4cee8f4b53a162a5baee90d3b2ed089d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Makefile -- Tux Commander build system
#
#    Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
#    Check for updates on tuxcmd.sourceforge.net
#
#    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 or
#    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


#  Specify paths
DESTDIR=/usr

# following paths are optional; needed only for Kylix compilation
KYLIXPREFIX=/usr/local/kylix3
GTK2FORPASCAL_LIBDIR=./gtk2

###  End of user writeable section



INSTALL=install -c
INSTALL_DATA = ${INSTALL} -m 644
CLEAN_OBJS=*.o *.a *.d *.s *.ppu *.dcu *.rst *~ *.~* core tuxcmd fpcver.inc
LIB_SUFFIX=`if test \`uname -m\` = x86_64; then echo 64; fi`


# -Ct must be disabled here, causes unneeded crashes
# -CR and -Cr must be disabled here, causes range check errors with gnome-power-manager
# -Cg generates internal compiler errors on i386
CFLAGS= -vweh -Un -Ci -Co



tuxcmd::
	echo "const" > fpcver.inc
	echo "  ConstFPCVersionString = '`fpc -iW`';" >> fpcver.inc
	echo "  ConstFPCDateString = '`fpc -iD`';" >> fpcver.inc
	echo "  ConstFPCCompilerOSString = '`fpc -iSO`';" >> fpcver.inc
	echo "  ConstFPCCompilerHostProcessorString = '`fpc -iSP`';" >> fpcver.inc
	echo "  ConstFPCTargetOSString = '`fpc -iTO`';" >> fpcver.inc
	echo "  ConstFPCTargetProcessorString = '`fpc -iTP`';" >> fpcver.inc
	fpc -Mdelphi $(CFLAGS) \
	    -d__FPC__ \
	    -Fu./libgtk_kylix -Fu./translations -Fu./vfs \
	    tuxcmd.dpr

debug: CFLAGS += -g
debug: tuxcmd


kylix::
	$(KYLIXPREFIX)/bin/dcc -DKYLIX \
	-U$(GTK2FORPASCAL_LIBDIR)/glib -U$(GTK2FORPASCAL_LIBDIR)/pango \
	-U$(GTK2FORPASCAL_LIBDIR)/atk -U$(GTK2FORPASCAL_LIBDIR)/gtk+/gtk \
	-U$(GTK2FORPASCAL_LIBDIR)/gtk+/gdk -U$(GTK2FORPASCAL_LIBDIR)/gtk+/gdk-pixbuf \
	-U$(KYLIXPREFIX)/lib \
	-U./libgtk_kylix -U./translations -U./vfs ./tuxcmd.dpr


modules::
	(cd "vfs" && $(MAKE) `echo $@ | sed s/-recursive//` ) || exit 1;

modules_install:
	(cd "vfs" && $(MAKE) install "$(DESTDIR)") || exit 1;



clean cleandir:
	rm -f $(CLEAN_OBJS)
	( cd vfs && rm -f $(CLEAN_OBJS) )
	( cd libgtk_kylix && rm -f $(CLEAN_OBJS) )
	( cd translations && rm -f $(CLEAN_OBJS) )
	

tuxcmd_install:
	if [ ! -d $(DESTDIR) ]; then mkdir -p $(DESTDIR); fi;
	if [ ! -d $(DESTDIR)/bin ]; then mkdir -p $(DESTDIR)/bin; fi;
	if [ ! -d $(DESTDIR)/share ]; then mkdir -p $(DESTDIR)/share; fi;
	if [ ! -d $(DESTDIR)/share/doc ]; then mkdir -p $(DESTDIR)/share/doc; fi;
	if [ ! -d $(DESTDIR)/share/doc/tuxcmd ]; then mkdir -p $(DESTDIR)/share/doc/tuxcmd; fi;
	if [ ! -d $(DESTDIR)/lib$(LIB_SUFFIX) ]; then mkdir -p $(DESTDIR)/lib$(LIB_SUFFIX); fi;
	if [ ! -d $(DESTDIR)/lib$(LIB_SUFFIX)/tuxcmd ]; then mkdir -p $(DESTDIR)/lib$(LIB_SUFFIX)/tuxcmd; fi;
	$(INSTALL) ./tuxcmd $(DESTDIR)/bin
	$(INSTALL_DATA) ./COPYING $(DESTDIR)/share/doc/tuxcmd
	$(INSTALL_DATA) ./README $(DESTDIR)/share/doc/tuxcmd

uninstall:
	if [ -f $(DESTDIR)/bin/tuxcmd ]; then rm -f $(DESTDIR)/bin/tuxcmd; fi;
	if [ -d $(DESTDIR)/share/doc/tuxcmd ]; then rm -Rf $(DESTDIR)/share/doc/tuxcmd; fi;
	if [ -d $(DESTDIR)/lib$(LIB_SUFFIX)/tuxcmd ]; then rm -Rf $(DESTDIR)/lib$(LIB_SUFFIX)/tuxcmd; fi;

help::
	@echo "Tux Commander build system"
	@echo
	@echo "Following targets are available:"
	@echo
	@echo "  tuxcmd              Build tuxcmd with FreePascal [default]"
	@echo "  kylix               Build tuxcmd with Kylix (needs paths setup in Makefile)"
	@echo "  install             Install tuxcmd to the system (DESTDIR overrides default path)"
	@echo "  uninstall           Remove tuxcmd from the system (DESTDIR overrides default path)"
	@echo "  clean               Cleanup the build structure"
	@echo "  modules             Build modules (in vfs/)"
	@echo "  modules_install     Install modules to the system"
	@echo
	@exit 0

install: tuxcmd_install

all: tuxcmd