diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e784468 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +include Makefile.top + +MODULE = vlibras_desktop +LIBNAME = CorePlugin + +VERSION = 0.2 + +CFLAGS = \ + -I$(INCDIR)\ + -I/usr/include/python2.7 + +CFLAGS += -m32 -g -fPIC + +LDFLAGS = \ + -L/usr/lib/python2.7/config\ + -lpthread\ + -ldl\ + -lutil\ + -lm\ + -lpython2.7 + +HEADERS = \ + py_tradutor.h\ + core_plugin.h + +SOURCES = \ + py_tradutor.cpp\ + core_plugin.cpp + +.SUFFIXES: .cpp .o .h + +include Makefile.build + +default: all diff --git a/Makefile.build b/Makefile.build new file mode 100644 index 0000000..53c0946 --- /dev/null +++ b/Makefile.build @@ -0,0 +1,24 @@ +OBJS = $(SOURCES:.cpp=.o) +LIB = lib$(LIBNAME)-$(VERSION).so + +all: shared + +shared: $(addprefix $(SRCDIR),$(OBJS)) + @mkdir $(PLUGINDIR) > /dev/null 2>&1 && \ + echo "Create directory $(PLUGINDIR)... $(OK)" || echo -n "" + @echo -n Linking $(LIB) ... + @$(CC) -shared -o $(PLUGINDIR)$(LIB) $(addprefix $(SRCDIR),$(OBJS)) $(LDFLAGS) || \ + (echo " $(FAILED)"; exit 1;) + @cd $(PLUGINDIR); \ + ln -f -s $(LIB) lib$(LIBNAME).so; \ + cd .. && echo " $(OK)" || (echo " $(FAILED)"; exit 1;) + +%.o: %.cpp + @echo -n Compiling file $(notdir $<) to $(notdir $@) ... + @$(CXX) $(CFLAGS) -c $< -o $@ && \ + echo " $(OK)" || (echo " $(FAILED)"; exit 1;) + +clean: + @echo -n Cleaning... + @rm -rf $(addprefix $(SRCDIR),$(OBJS)) $(PLUGINDIR) 2> /dev/null && \ + echo " $(OK)" || (echo " $(FAILED)"; exit 1;) diff --git a/Makefile.top b/Makefile.top new file mode 100644 index 0000000..2249fe9 --- /dev/null +++ b/Makefile.top @@ -0,0 +1,13 @@ +INSTALL_PATH = . + +CC = gcc +CXX = g++ + +INCDIR = ./include/ +SRCDIR = ./src/ +TESTSDIR = ./tests/ +PLUGINDIR = ./plugin/ +DOCDIR = ./doc/ + +OK = \033[30;32mOK\033[m +FAILED = \033[30;31mFAILED\033[m diff --git a/README b/README index f0b7a92..13aea09 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ COMPILE $ g++ -Iinclude/ -I/usr/include/python2.7 -g -c src/py_tradutor.cpp src/core_plugin.cpp -fPIC -Wall -------------------------------------------- -BUILD EXECUTABLE +BUILD SHARED LIBRARY (.so) -------------------------------------------- $ g++ -shared -fPIC py_tradutor.o core_plugin.o $(python2.7-config --ldflags) -o libCorePlugin.so -lm diff --git a/plugin/libCorePlugin-0.2.so b/plugin/libCorePlugin-0.2.so new file mode 100755 index 0000000..c8d7fa0 Binary files /dev/null and b/plugin/libCorePlugin-0.2.so differ diff --git a/plugin/libCorePlugin.so b/plugin/libCorePlugin.so new file mode 120000 index 0000000..a37bec0 --- /dev/null +++ b/plugin/libCorePlugin.so @@ -0,0 +1 @@ +libCorePlugin-0.2.so \ No newline at end of file diff --git a/src/core_plugin.o b/src/core_plugin.o new file mode 100644 index 0000000..a972738 Binary files /dev/null and b/src/core_plugin.o differ diff --git a/src/py_tradutor.o b/src/py_tradutor.o new file mode 100644 index 0000000..bc1ad73 Binary files /dev/null and b/src/py_tradutor.o differ -- libgit2 0.21.2