Skip to content

Commit d06ab88

Browse files
author
Evan Klitzke
committed
Makefile improvements
1 parent 06bf998 commit d06ab88

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
CC = gcc
22
CFLAGS = -Os -Wall
3-
LDFLAGS = -lbz2 -llua
3+
LDFLAGS = -lbz2
44
SOFLAGS = -fpic -shared
55

6+
# FIXME: Assumes you have GCC 4.4 installed for building on OS X
67
ifeq ($(shell uname),Darwin)
78
CC = gcc-mp-4.4
8-
CPPFLAGS = -I/opt/local/include
9-
LDFLAGS += -L/opt/local/lib
109
endif
1110

11+
ifeq ($(shell pkg-config --exists lua5.1; echo $$?),0)
12+
PFLAGS = $(shell pkg-config --cflags --libs lua5.1)
13+
else
14+
PFLAGS = $(shell pkg-config --cflags --libs lua)
15+
endif
1216

1317
bz2.so: lbz.c
14-
$(CC) $(CFLAGS) $(SOFLAGS) $(CPPFLAGS) $(LDFLAGS) lbz.c -o bz2.so
18+
$(CC) $(SOFLAGS) $(PFLAGS) $(CFLAGS) $(LDFLAGS) lbz.c -o bz2.so
1519

1620
clean:
1721
-rm -f bz2.so

README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@ This software is released under a BSD-style license (to be exact, the ISC
44
license). The full license can be found in the LICENSE file included with this
55
source code.
66

7+
This has been tested with Lua 5.1 on Mac OS X (10.5) and Ubuntu. Getting this
8+
to work on Windows or with an earlier version of Lua is probably just a matter
9+
of massaging the Makefile. If this extension doesn't build for a platform
10+
you're using and you're able to fix the Makefile, please send me your patch.
11+
712
More information about Lua: http://www.lua.org/
813
More information about bzip2: http://www.bzip.org/

0 commit comments

Comments
 (0)