blob: 06bbd65abf3d70069eafdca4b1798831679f1471 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# path definitions
DESTDIR = /usr
INSTALL = install -c
INSTALL_DATA = ${INSTALL} -m 644
DIR_LIBARCHIVE = ./libarchive-2.7.1
# compiler options
CC = gcc
CFLAGS = -I. -I/usr/include \
-Wall -Wtype-limits -fPIC -O2 -g -ggdb \
-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 -o \`uname -m\` = ppc64; then echo 64; fi`
VFS_COMMON_OBJECTS = filelist.o filelist-vfs-intf.o strutils.o vfsutils.o
VFS_OBJECTS = libarchive.o
.SUFFIXES: .c
.c.o:
$(CC) $(CFLAGS) `pkg-config glib-2.0 gio-2.0 --cflags` -c $<
all: static
LIBARCHIVE_LIBS_EXT = `grep "$(DIR_LIBARCHIVE)/Makefile" -e '^LIBS = -l' | sed 's/.*=\(.*\)/\1/'`
shared: CFLAGS += -DMODULE_SHARED
shared: $(VFS_COMMON_OBJECTS) $(VFS_OBJECTS)
$(CC) -shared -o libarchive_plugin.so $(VFS_COMMON_OBJECTS) $(VFS_OBJECTS) $(CFLAGS) `pkg-config glib-2.0 gio-2.0 --libs` -larchive
static: CFLAGS += -I$(DIR_LIBARCHIVE) -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 gio-2.0 --libs` $(LIBARCHIVE_LIBS_EXT)
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)" && CFLAGS="-Wall" ./configure --enable-static --disable-shared --disable-bsdtar --disable-bsdcpio --with-pic && $(MAKE)) || exit 1; \
echo; echo "Libarchive build successful"; echo; \
fi;
filelist.o: filelist.h filelist.c
filelist-vfs-intf.o: filelist-vfs-intf.h filelist-vfs-intf.c
strutils.o: strutils.h strutils.c
vfsutils.o: vfsutils.h vfsutils.c
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;
|