summaryrefslogtreecommitdiff
path: root/libarchive/Makefile
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2008-06-08 11:04:43 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2008-06-08 11:04:43 +0200
commit16f738ecee689c6feb2acb7e4ef4d9bb4144ae7d (patch)
tree3d22f54f7298f81b18ed66d05a62fa8bfab359ab /libarchive/Makefile
downloadtuxcmd-modules-16f738ecee689c6feb2acb7e4ef4d9bb4144ae7d.tar.xz
Diffstat (limited to 'libarchive/Makefile')
-rw-r--r--libarchive/Makefile62
1 files changed, 62 insertions, 0 deletions
diff --git a/libarchive/Makefile b/libarchive/Makefile
new file mode 100644
index 0000000..fc6f941
--- /dev/null
+++ b/libarchive/Makefile
@@ -0,0 +1,62 @@
+# path definitions
+DESTDIR = /usr
+INSTALL=install -c
+INSTALL_DATA = ${INSTALL} -m 644
+DIR_COMMON=../common/
+DIR_LIBARCHIVE=./libarchive-2.4.17
+
+# compiler options
+CC = gcc
+CPP = g++
+CFLAGS =-I. -I/usr/include -I$(DIR_COMMON) \
+ -Wall -fPIC -O2 -g \
+ -DG_DISABLE_DEPRECATED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE \
+ -D__VERBOSE_DEBUGx
+
+LIB_SUFFIX=`if test \`uname -m\` = x86_64; then echo 64; fi`
+
+VFS_COMMON_OBJECTS=strutils.o treepathutils.o treepath_vfs.o vfsutils.o
+
+VFS_OBJECTS=libarchive.o
+
+
+.SUFFIXES: .c .cpp
+.c.o:
+ $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c $<
+.cpp.o:
+ $(CPP) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c $<
+
+
+all: static
+
+
+shared: $(VFS_COMMON_OBJECTS) $(VFS_OBJECTS)
+ $(CC) -shared -o libarchive_plugin.so $(VFS_COMMON_OBJECTS) $(VFS_OBJECTS) $(CFLAGS) `pkg-config glib-2.0 --libs` -larchive -lz -lbz2
+
+static: CFLAGS += -I$(DIR_LIBARCHIVE)/libarchive
+static: lib_libarchive_compile $(VFS_COMMON_OBJECTS) $(VFS_OBJECTS)
+ $(CC) -shared -o libarchive_plugin.so $(VFS_COMMON_OBJECTS) $(VFS_OBJECTS) $(DIR_LIBARCHIVE)/.libs/libarchive.a $(CFLAGS) `pkg-config glib-2.0 --libs` -lz -lbz2
+
+lib_libarchive_compile:
+ @which uudecode > /dev/null || exit 1;
+ @if test ! -f "$(DIR_LIBARCHIVE)/.libs/libarchive.a"; then \
+ echo "Building libarchive..."; echo; \
+ (cd "$(DIR_LIBARCHIVE)" && ./configure --enable-static --disable-shared --disable-bsdtar --disable-bsdcpio --with-pic && $(MAKE)) || exit 1; \
+ echo; echo "Libarchive build successful"; echo; \
+ fi;
+
+
+strutils.o: strutils.c strutils.h
+treepathutils.o: treepathutils.c treepathutils.h
+vfsutils.o: vfsutils.c vfsutils.h
+treepath_vfs.o: treepath_vfs.c treepath_vfs.h
+
+install::
+ $(INSTALL) ./libarchive_plugin.so $(DESTDIR)/lib$(LIB_SUFFIX)/tuxcmd/
+
+clean:
+ rm -f *.o *.d *.gch libarchive_plugin.so
+ @if test -e $(DIR_LIBARCHIVE)/Makefile; then \
+ (cd "$(DIR_LIBARCHIVE)" && $(MAKE) clean) \
+ fi;
+