-# Mac OSX makefile for OpenJPEG
+# MacOSX makefile for OpenJPEG
VER_MAJOR = 1
VER_MINOR = 1.1
# General configuration variables:
CC = gcc
-LIBTOOL = libtool
+LIBTOOLSTAT = libtool
+LIBTOOLDYN = gcc
PREFIX = /usr
INSTALL_LIBDIR = $(PREFIX)/lib
INSTALL_INCLUDE = $(PREFIX)/include
COMPILERFLAGS = -O3 -fPIC
-LIBRARIES = -lc -lgcc -lstdc++
MODULES = $(SRCS:.c=.o)
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
TARGET = openjpeg
STATICLIB = lib$(TARGET).a
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib
-LIBNAME = lib$(TARGET).dylib.$(VER_MAJOR)
+LIBNAME = lib$(TARGET).dylib
all: OpenJPEG
+dos2unix:
+ @$(DOS2UNIX) $(SRCS) $(INCLS)
+
dist: OpenJPEG
install -d dist
install -m 644 $(STATICLIB) dist
$(CC) $(CFLAGS) -c $< -o $@
$(STATICLIB): $(MODULES)
- $(LIBTOOL) -o $@ $(MODULES)
+ $(LIBTOOLSTAT) -o $@ $(MODULES)
$(SHAREDLIB): $(MODULES)
- $(LIBTOOL) -dynamic $(LIBRARIES) -o $@ $(MODULES)
+ $(LIBTOOLDYN) -dynamiclib -o $@ $(MODULES)
install:
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
install -m 755 -o root -g wheel $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
- install -m 644 -o root -g root libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
- -ldconfig
+ install -m 644 -o root -g wheel ./libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
clean:
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
------------------------
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and use one of the following commands to build an encoder and decoder respectively:
-gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm
-gcc convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm
+gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
+gcc convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
-You should add '-L..' to those lines if you did not use the 'osxinstall' target (and the 'osxclean' target neither...).
+You should add '-L..' and to those lines if you did not use the 'install' target (and the 'clean' target neither...).