Make openjpeg

From Second Life Wiki
Jump to navigation Jump to search

i386

Save this file into Makefile-i386.osx:

# Mac OSX makefile for OpenJPEG

VER_MAJOR = 1
VER_MINOR = 0.0

SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/fix.c ./libopenjpeg/image.c ./libopenjpeg/int.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_includes.h
INCLUDE = -Ilibopenjpeg

# General configuration variables:
CC = gcc
LIBTOOL = libtool

INSTALLDIR = /usr/lib

COMPILERFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O3 -arch i386
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)



default: all

all: dist

dist: OpenJPEG
	mkdir dist
	cp *.a dist/
	cp *.dylib dist/
	cp libopenjpeg/openjpeg.h dist/

OpenJPEG: $(STATICLIB) $(SHAREDLIB)

.c.o:
	$(CC) $(CFLAGS) -c $< -o $@

$(STATICLIB): $(MODULES)
	$(LIBTOOL) -o $@ $(MODULES)

$(SHAREDLIB): $(MODULES)
	$(LIBTOOL) -dynamic $(LIBRARIES) -o $@ $(MODULES)

install:
	install -m 644 -o root -g wheel $(STATICLIB) $(INSTALLDIR)
	install -m 755 -o root -g wheel $(SHAREDLIB) $(INSTALLDIR)
	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
	ranlib $(INSTALLDIR)/$(STATICLIB)

clean:
	rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)

ppc

Save this file into Makefile-i386.ppc:

# Mac OSX makefile for OpenJPEG

VER_MAJOR = 1
VER_MINOR = 0.0

SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/fix.c ./libopenjpeg/image.c ./libopenjpeg/int.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_includes.h
INCLUDE = -Ilibopenjpeg

# General configuration variables:
CC = gcc
LIBTOOL = libtool

INSTALLDIR = /usr/lib

COMPILERFLAGS = -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -O3 -arch ppc
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)



default: all

all: dist

dist: OpenJPEG
	mkdir dist
	cp *.a dist/
	cp *.dylib dist/
	cp libopenjpeg/openjpeg.h dist/

OpenJPEG: $(STATICLIB) $(SHAREDLIB)

.c.o:
	$(CC) $(CFLAGS) -c $< -o $@

$(STATICLIB): $(MODULES)
	$(LIBTOOL) -o $@ $(MODULES)

$(SHAREDLIB): $(MODULES)
	$(LIBTOOL) -dynamic $(LIBRARIES) -o $@ $(MODULES)

install:
	install -m 644 -o root -g wheel $(STATICLIB) $(INSTALLDIR)
	install -m 755 -o root -g wheel $(SHAREDLIB) $(INSTALLDIR)
	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
	ranlib $(INSTALLDIR)/$(STATICLIB)

clean:
	rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)