Changed build choice in configure.ac/Makefile.am/Makefile.nix: shared xor static

This commit is contained in:
Winfried 2010-12-10 04:27:40 +00:00
parent 1ffab354d9
commit 428dea2e25
4 changed files with 30 additions and 16 deletions

View File

@ -34,10 +34,11 @@ MODULES = $(SRCS:.c=.o)
CFLAGS = $(COMPILERFLAGS) $(INCLUDE) CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
LIBNAME = lib$(TARGET) LIBNAME = lib$(TARGET)
STATICLIB = $(LIBNAME).a
ifeq ($(ENABLE_SHARED),yes) ifeq ($(ENABLE_SHARED),yes)
SHAREDLIB = $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR).$(JP3D_BUILD) SHAREDLIB = $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR).$(JP3D_BUILD)
else
STATICLIB = $(LIBNAME).a
endif endif
default: all default: all
@ -45,13 +46,14 @@ default: all
all: Jp3dVM all: Jp3dVM
make -C codec -f Makefile.nix all make -C codec -f Makefile.nix all
install -d ../bin install -d ../bin
install -m 644 $(STATICLIB) ../bin
ifeq ($(ENABLE_SHARED),yes) ifeq ($(ENABLE_SHARED),yes)
install -m 755 $(SHAREDLIB) ../bin install -m 755 $(SHAREDLIB) ../bin
(cd ../bin && \ (cd ../bin && \
ln -sf $(SHAREDLIB) $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR)) ln -sf $(SHAREDLIB) $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR))
(cd ../bin && \ (cd ../bin && \
ln -sf $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR) $(LIBNAME).so) ln -sf $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR) $(LIBNAME).so)
else
install -m 644 $(STATICLIB) ../bin
endif endif
dos2unix: dos2unix:
@ -62,26 +64,26 @@ Jp3dVM: $(STATICLIB) $(SHAREDLIB)
.c.o: .c.o:
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
$(STATICLIB): $(MODULES)
$(AR) r $@ $(MODULES)
ifeq ($(ENABLE_SHARED),yes) ifeq ($(ENABLE_SHARED),yes)
$(SHAREDLIB): $(MODULES) $(SHAREDLIB): $(MODULES)
$(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES) $(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
else
$(STATICLIB): $(MODULES)
$(AR) r $@ $(MODULES)
endif endif
install: Jp3dVM install: Jp3dVM
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' install -d '$(DESTDIR)$(INSTALL_LIBDIR)'
install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
(cd $(DESTDIR)$(INSTALL_LIBDIR) && ranlib $(STATICLIB))
ifeq ($(ENABLE_SHARED),yes) ifeq ($(ENABLE_SHARED),yes)
install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \ (cd $(DESTDIR)$(INSTALL_LIBDIR) && \
ln -sf $(SHAREDLIB) $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR) ) ln -sf $(SHAREDLIB) $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR) )
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \ (cd $(DESTDIR)$(INSTALL_LIBDIR) && \
ln -sf $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR) $(LIBNAME).so ) ln -sf $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR) $(LIBNAME).so )
else
install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
(cd $(DESTDIR)$(INSTALL_LIBDIR) && ranlib $(STATICLIB))
endif endif
$(LDCONFIG)
install -d $(DESTDIR)$(INSTALL_INCLUDE) install -d $(DESTDIR)$(INSTALL_INCLUDE)
rm -f $(DESTDIR)$(INSTALL_INCLUDE)/openjpeg3d.h rm -f $(DESTDIR)$(INSTALL_INCLUDE)/openjpeg3d.h
install -m 644 -o root -g root libjp3dvm/openjpeg3d.h \ install -m 644 -o root -g root libjp3dvm/openjpeg3d.h \
@ -91,15 +93,16 @@ endif
make -C codec -f Makefile.nix install make -C codec -f Makefile.nix install
uninstall: uninstall:
rm -f $(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)
ifeq ($(ENABLE_SHARED),yes) ifeq ($(ENABLE_SHARED),yes)
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \ (cd $(DESTDIR)$(INSTALL_LIBDIR) && \
rm -f $(LIBNAME).so $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR) $(SHAREDLIB)) rm -f $(LIBNAME).so $(LIBNAME).so.$(JP3D_MAJOR).$(JP3D_MINOR) $(SHAREDLIB))
else
rm -f $(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)
endif endif
$(LDCONFIG)
rm -f $(DESTDIR)$(prefix)/include/openjpeg3d.h rm -f $(DESTDIR)$(prefix)/include/openjpeg3d.h
rm -rf $(DESTDIR)$(INSTALL_INCLUDE) rm -rf $(DESTDIR)$(INSTALL_INCLUDE)
make -C codec -f Makefile.nix uninstall make -C codec -f Makefile.nix uninstall
clean: clean:
rm -f core u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) rm -f core u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB)
make -C codec -f Makefile.nix clean make -C codec -f Makefile.nix clean

View File

@ -2,7 +2,11 @@
USERLIBS = USERLIBS =
INCLUDES = -I. -I../libjp3dvm INCLUDES = -I. -I../libjp3dvm
CFLAGS = -Wall $(INCLUDES) -static CFLAGS = -Wall $(INCLUDES)
if with_staticlibs
CFLAGS += -static
endif
bin_PROGRAMS = jp3d_to_volume volume_to_jp3d bin_PROGRAMS = jp3d_to_volume volume_to_jp3d
LDADD = $(USERLIBS) ../libjp3dvm/libopenjp3dvm.la LDADD = $(USERLIBS) ../libjp3dvm/libopenjp3dvm.la

View File

@ -37,6 +37,7 @@ POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
target_triplet = @target@ target_triplet = @target@
@with_staticlibs_TRUE@am__append_1 = -static
bin_PROGRAMS = jp3d_to_volume$(EXEEXT) volume_to_jp3d$(EXEEXT) bin_PROGRAMS = jp3d_to_volume$(EXEEXT) volume_to_jp3d$(EXEEXT)
subdir = jp3d/codec subdir = jp3d/codec
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@ -92,7 +93,7 @@ AWK = @AWK@
BUILD_NR = @BUILD_NR@ BUILD_NR = @BUILD_NR@
CC = @CC@ CC = @CC@
CCDEPMODE = @CCDEPMODE@ CCDEPMODE = @CCDEPMODE@
CFLAGS = -Wall $(INCLUDES) -static CFLAGS = -Wall $(INCLUDES) $(am__append_1)
CPP = @CPP@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
CXX = @CXX@ CXX = @CXX@

View File

@ -6,17 +6,23 @@ INSTALL_BIN = $(prefix)/bin
CFLAGS = -Wall -I. -I../libjp3dvm -lstdc++ # -g -p -pg CFLAGS = -Wall -I. -I../libjp3dvm -lstdc++ # -g -p -pg
#USERLIBS = -lm #USERLIBS = -lm
ifeq ($(ENABLE_SHARED),yes)
ELIB = ../libopenjp3dvm.so.$(JP3D_MAJOR).$(JP3D_MINOR).$(JP3D_BUILD)
else
ELIB = ../libopenjp3dvm.a
endif
all: jp3d_to_volume volume_to_jp3d all: jp3d_to_volume volume_to_jp3d
install -d ../../bin install -d ../../bin
install jp3d_to_volume volume_to_jp3d ../../bin install jp3d_to_volume volume_to_jp3d ../../bin
jp3d_to_volume: jp3d_to_volume.c ../libopenjp3dvm.a jp3d_to_volume: jp3d_to_volume.c $(ELIB)
$(CC) $(CFLAGS) getopt.c convert.c jp3d_to_volume.c \ $(CC) $(CFLAGS) getopt.c convert.c jp3d_to_volume.c \
-o jp3d_to_volume ../libopenjp3dvm.a $(USERLIBS) -o jp3d_to_volume $(ELIB) $(USERLIBS)
volume_to_jp3d: volume_to_jp3d.c ../libopenjp3dvm.a volume_to_jp3d: volume_to_jp3d.c $(ELIB)
$(CC) $(CFLAGS) getopt.c convert.c volume_to_jp3d.c \ $(CC) $(CFLAGS) getopt.c convert.c volume_to_jp3d.c \
-o volume_to_jp3d ../libopenjp3dvm.a $(USERLIBS) -o volume_to_jp3d $(ELIB) $(USERLIBS)
clean: clean:
rm -f jp3d_to_volume volume_to_jp3d rm -f jp3d_to_volume volume_to_jp3d