1# luagd -- gd bindings for the Lua Programming Language.
2# (c) 2004-06 Alexandre Erwin Ittner <aittner@netuno.com.br>
3#
4# Permission is hereby granted, free of charge, to any person obtaining
5# a copy of this software and associated documentation files (the
6# "Software"), to deal in the Software without restriction, including
7# without limitation the rights to use, copy, modify, merge, publish,
8# distribute, sublicense, and/or sell copies of the Software, and to
9# permit persons to whom the Software is furnished to do so, subject to
10# the following conditions:
11#
12# The above copyright notice and this permission notice shall be
13# included in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18# IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY
19# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22#
23# If you use this package in a product, an acknowledgment in the product
24# documentation would be greatly appreciated (but it is not required).
25#
26
27CC=gcc
28
29# ---------------------------------------------------------------------------
30# Automatic configuration using pkgconfig, gd-config and sed. These
31# lines should work on most Linux/Unix systems. If your system does not
32# have these programs you must comment out these lines and uncomment and
33# change the next ones.
34
35# Name of .pc file. "lua5.1" on Debian/Ubuntu
36LUAPKG=lua5.1
37OUTFILE=gd.so
38CFLAGS=`gdlib-config --cflags` `pkg-config $(LUAPKG) --cflags` -O3 -Wall
39GDFEATURES=`gdlib-config --features |sed -e "s/GD_/-DGD_/g"`
40LFLAGS=-shared `gdlib-config --ldflags` `gdlib-config --libs` \
41    `pkg-config $(LUAPKG) --libs` -lgd
42INSTALL_PATH=`pkg-config $(LUAPKG) --variable=INSTALL_CMOD`
43
44
45# ---------------------------------------------------------------------------
46# Manual configuration for systems without pkgconfig.
47
48#OUTFILE=gd.so
49#CFLAGS=-Wall `gdlib-config --cflags` -I/usr/include/lua5.1 -O3
50#GDFEATURES=`gdlib-config --features |sed -e "s/GD_/-DGD_/g"`
51#LFLAGS=-shared `gdlib-config --ldflags` `gdlib-config --libs` -llua51 -lgd
52#INSTALL_PATH=/usr/lib/lua/
53
54
55# ---------------------------------------------------------------------------
56# Manual configuration for Windows and systems without sed, pkgconfig, etc.
57# Uncomment, change and good luck :)
58
59#OUTFILE=gd.dll
60#CFLAGS=-Wall -IC:/lua5.1/ -O3
61#GDFEATURES=-DGD_XPM -DGD_JPEG -DGD_FONTCONFIG -DGD_FREETYPE -DGD_PNG -DGD_GIF
62#LFLAGS=-shared -lgd2 -lm -llua51
63#INSTALL_PATH="C:/Program Files/lua/"
64# ---------------------------------------------------------------------------
65
66
67all: $(OUTFILE)
68
69$(OUTFILE): luagd.c
70	$(CC) -o $(OUTFILE) $(GDFEATURES) $(CFLAGS) $(LFLAGS) luagd.c
71	lua test_features.lua
72
73install: $(OUTFILE)
74	install -s $(OUTFILE) $(INSTALL_PATH)
75
76clean:
77	rm -f $(OUTFILE) *.o
78