From 7277e28d91f13bc23ac148cd76a737c0d304cf04 Mon Sep 17 00:00:00 2001 From: Brandon Gilmore Date: Fri, 8 Apr 2011 17:11:58 -0700 Subject: [PATCH] made buildable inside source tree --- Makefile | 35 +++++++++++++++++++++++++++++++++++ api.c | 1 + api.h | 1 - build.sh | 4 ---- modinfo | 1 + python.c | 1 + 6 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 Makefile delete mode 100644 build.sh create mode 100644 modinfo diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5e27fe2 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +## Makefile for src/mod/python.mod + +srcdir = . + +# needed for building on OSX +PYTHON_INCLUDE = /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 +PYTHON_LIB = /usr/lib +REAL_LD = /usr/bin/ld + +doofus: + @echo "" + @echo "Let's try this from the right directory..." + @echo "" + @cd ../../../; make + +static: ../python.o + +modules: ../../../python.$(MOD_EXT) + +../python.o: api.o python.o + $(REAL_LD) -o ../python.o -r *.o + +../../../python.$(MOD_EXT): ../python.o + $(LD) -L$(PYTHON_LIB) -o ../../../python.$(MOD_EXT) ../python.o -lpython $(XLIBS) $(MODULE_XLIBS) + $(STRIP) ../../../python.$(MOD_EXT) + +%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -I$(PYTHON_INCLUDE) -DMAKING_MODS -c $< + +depend: + $(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .depend + +clean: + @rm -f .depend *.o *.$(MOD_EXT) + diff --git a/api.c b/api.c index 81f052e..3ec7b26 100644 --- a/api.c +++ b/api.c @@ -1,4 +1,5 @@ #include "api.h" +#include "../module.h" extern Function *global; extern int python_isolated; diff --git a/api.h b/api.h index 9988978..860b9b3 100644 --- a/api.h +++ b/api.h @@ -3,7 +3,6 @@ #include #include "khash.h" -#include "../module.h" #define MODULE_NAME "python" #define MODULE_VER_MAJOR 0 diff --git a/build.sh b/build.sh deleted file mode 100644 index 7668572..0000000 --- a/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -gcc -fPIC -g -O2 -pipe -Wall -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I../eggdrop1.6.20/src/mod/wire.mod -I../eggdrop1.6.20 -DHAVE_CONFIG_H -DMAKING_MODS -c python.c -gcc -fPIC -g -O2 -pipe -Wall -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I../eggdrop1.6.20/src/mod/wire.mod -I../eggdrop1.6.20 -DHAVE_CONFIG_H -DMAKING_MODS -c api.c -ld -bundle -undefined error -o python.so python.o api.o -L/usr/lib -ltcl8.5 -lm -ldl -lpthread -lpython2.6 /usr/lib/bundle1.o -cp python.so ../eggdrop1.6.20/dev/modules/ diff --git a/modinfo b/modinfo new file mode 100644 index 0000000..bce475b --- /dev/null +++ b/modinfo @@ -0,0 +1 @@ +DESC:Provides support for loading Python modules. diff --git a/python.c b/python.c index 4c906a0..22c2591 100644 --- a/python.c +++ b/python.c @@ -29,6 +29,7 @@ #include "api.h" #include "pymod.h" +#include "../module.h" #undef global Function *global = NULL;