Debian Codegraph @

terps/agility/Makefile.glk

raw
1 # Set locations of Glk library and include directories, and Glk make include.
2 # For building the IFP plugin, you should probably use Xglk headers.
3 # For X Glk library:
4 GLKLIBDIR = ../xglk
5 GLKINCDIR = ../xglk
6 GLKMAKEINC = ../xglk/Make.xglk
7 # ..., or for curses Glk library:
8 #GLKLIBDIR = ../glkterm
9 #GLKINCDIR = ../glkterm
10 #GLKMAKEINC = ../glkterm/Make.glkterm
11 # ..., or for the "cheap" Glk library:
12 #GLKLIBDIR = ../cheapglk
13 #GLKINCDIR = ../cheapglk
14 #GLKMAKEINC = ../cheapglk/Make.cheapglk
15
16 # Set locations of IFP library and include directories, and header tool.
17 # For installed IFP, these would be something like:
18 IFPLIBDIR = /usr/lib
19 IFPINCDIR = /usr/include
20 IFPHDRTOOL = /usr/bin/ifphdr
21 # ...whereas for IFP newly built alongside xglk, more like:
22 #IFPLIBDIR = ../ifp
23 #IFPINCDIR = ../ifp
24 #IFPHDRTOOL = ../ifp/ifphdr
25
26 # IFP header definition.
27 IFPHDR = agility.hdr
28
29 # AGiliTy version.
30 VERSION = 1.1.1
31
32 # Common definitions.
33 CC = gcc
34 WARNINGS = -Wall # -W
35 DEBUG =
36 OPTIMIZE = -O2
37
38 # Get the definitions for Glk LINKLIBS and GLKLIB.
39 include $(GLKMAKEINC)
40
41 CFLAGS = -fPIC -ansi -DGLK -I$(GLKINCDIR) $(WARNINGS) $(DEBUG) $(OPTIMIZE)
42 # CFLAGS= -I$(GLKINCDIR) $(WARNINGS) $(DEBUG) $(OPTIMIZE)
43 LDFLAGS = $(DEBUG)
44
45 BASE = agtread.o gamedata.o util.o agxfile.o auxfile.o filename.o
46 AGIL = parser.o exec.o runverb.o metacommand.o savegame.o debugcmd.o agil.o \
47 token.o disassemble.o object.o
48 INTERFACE= interface.o os_glk.o
49 OS_LIB = $(LINKLIBS) -L$(GLKLIBDIR) $(GLKLIB)
50
51 all:glkagil agtout agt2agx agility-$(VERSION).so
52
53 # Build the standalone Glk AGiliTy.
54 # See os_glk.c __wrap_exit() comments for details on -Wl,--wrap... option.
55 glkagil: $(BASE) $(AGIL) $(INTERFACE)
56 $(CC) $(LDFLAGS) -o glkagil $(AGIL) $(BASE) $(INTERFACE) $(OS_LIB)\
57 -Wl,--wrap,toupper,--wrap,tolower
58
59 # Build the support tools.
60 agtout: agtout.o disassemble.o agilstub.o $(BASE)
61 $(CC) $(LDFLAGS) -o agtout agtout.o disassemble.o agilstub.o $(BASE)
62
63 agt2agx: agt2agx.o agilstub.o $(BASE)
64 $(CC) $(CFLAGS) -o agt2agx agt2agx.o agilstub.o $(BASE)
65
66 # Build an AGiliTy IFP plugin.
67 # Wrapper toupper and tolower as above, and see os_glk.c __wrap_exit()
68 # comments for full details on why we also have to wrapper exit here.
69 agility-$(VERSION).so: $(BASE) $(AGIL) $(INTERFACE) $(IFPHDR)
70 rm -f agility_plugin.c
71 $(IFPHDRTOOL) $(IFPHDR) agility_plugin.c
72 $(CC) -I$(IFPINCDIR) $(CFLAGS) -c agility_plugin.c
73 $(LD) -u ifpi_force_link -shared -Bsymbolic \
74 -o $@ $(AGIL) $(BASE) $(INTERFACE) \
75 agility_plugin.o -L$(IFPLIBDIR) -lifppi -lc \
76 --wrap toupper --wrap tolower --wrap exit
77
78 # Directory cleanup.
79 clean:
80 rm -f *.o glkagil agility-$(VERSION).so agility_plugin.c
81 rm -f agtout agt2agx core
82 rm -rf distribution binaries
83
84 # Distribution.
85 distclean: clean
86 maintainer-clean: clean
87 dist: distclean
88 mkdir distribution binaries
89 zip -r distribution/agil111src_glk.zip * -x distribution/\* binaries/
90 cp GPL readme.agility readme.glk binaries
91 $(MAKE) -f Makefile.glk \
92 GLKLIBDIR=../xglk GLKINCDIR=../xglk \
93 GLKMAKEINC=../xglk/Make.xglk agility-$(VERSION).so
94 mv agility-$(VERSION).so binaries
95 $(MAKE) -f Makefile.glk \
96 GLKLIBDIR=../xglk GLKINCDIR=../xglk \
97 GLKMAKEINC=../xglk/Make.xglk glkagil
98 mv glkagil binaries/xagil
99 $(MAKE) -f Makefile.glk \
100 GLKLIBDIR=../glkterm GLKINCDIR=../glkterm \
101 GLKMAKEINC=../glkterm/Make.glkterm glkagil
102 mv glkagil binaries/termagil
103 $(MAKE) -f Makefile.glk \
104 GLKLIBDIR=../cheapglk GLKINCDIR=../cheapglk \
105 GLKMAKEINC=../cheapglk/Make.cheapglk glkagil
106 mv glkagil binaries/cheapagil
107 $(MAKE) -f Makefile.glk agtout agt2agx
108 mv agtout agt2agx binaries
109 cd binaries; tar zcvf ../distribution/agil111linux_glk.tgz *
110
111 # Dependencies.
112 agilstub.o: agilstub.c
113 agtread.o : agtread.c agility.h config.h
114 agxfile.o : agxfile.c agility.h config.h
115 auxfile.o : auxfile.c agility.h config.h
116 agt2agx.o : agt2agx.c agility.h config.h
117 gamedata.o : gamedata.c agility.h config.h
118 parser.o: parser.c agility.h config.h interp.h
119 exec.o: exec.c agility.h config.h interp.h exec.h
120 runverb.o: runverb.c agility.h config.h interp.h exec.h
121 metacommand.o: metacommand.c agility.h config.h interp.h exec.h
122 token.o: token.c agility.h config.h interp.h exec.h
123 debugcmd.o: debugcmd.c agility.h config.h interp.h exec.h
124 disassemble.o: disassemble.c agility.h config.h
125 savegame.o: savegame.c interp.h agility.h config.h
126 agtout.o : agtout.c agility.h config.h
127 util.o: util.c agility.h config.h
128 interface.o: interface.c agility.h config.h interp.h
129 os_none.o: os_none.c agility.h config.h interp.h
130 os_termcap.o: os_termcap.c agility.h config.h interp.h
131 os_curses.o: os_curses.c agility.h config.h interp.h
132 os_msdos.o: os_msdos.c agility.h config.h interp.h
133 os_glk.o: os_glk.c agility.h config.h interp.h
134 agil.o: agil.c agility.h config.h interp.h
135 object.o: object.c agility.h config.h interp.h exec.h
136 filename.o: filename.c agility.h config.h
137