freeimage/Makefile.gnu

83 lines
2.2 KiB
Gnuplot

# Linux makefile for FreeImage
# This file can be generated by ./gensrclist.sh
include Makefile.srcs
# General configuration variables:
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib
# Converts cr/lf to just lf
DOS2UNIX = dos2unix
LIBRARIES = -lstdc++ -ljxrglue $(shell pkg-config --libs libjpeg libopenjp2 libpng libraw libtiff-4 libwebpmux OpenEXR zlib) -lm
MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS ?= -O3 -fPIC
override CFLAGS += -fexceptions -fvisibility=hidden
# OpenJPEG
override CFLAGS += -DOPJ_STATIC
# LibRaw
override CFLAGS += -DNO_LCMS
# LibJXR
override CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
override CFLAGS += $(INCLUDE) -I/usr/include/jxrlib $(shell pkg-config --cflags libjpeg libopenjp2 libpng libraw libtiff-4 libwebpmux OpenEXR zlib)
CXXFLAGS ?= -O3 -fPIC
override CXXFLAGS += -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
# LibJXR
override CXXFLAGS += -D__ANSI__
override CXXFLAGS += $(INCLUDE) -I/usr/include/jxrlib $(shell pkg-config --cflags libjpeg libopenjp2 libpng libraw libtiff-4 libwebpmux OpenEXR zlib)
TARGET = freeimage
STATICLIB = lib$(TARGET).a
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
LIBNAME = lib$(TARGET).so
VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
HEADER = Source/FreeImage.h
default: all
all: dist
dist: FreeImage
mkdir -p Dist
cp $(STATICLIB) Dist/
cp $(SHAREDLIB) Dist/
cp $(HEADER) Dist/
ln -sf $(SHAREDLIB) Dist/$(VERLIBNAME)
ln -sf $(VERLIBNAME) Dist/$(LIBNAME)
dos2unix:
@$(DOS2UNIX) $(SRCS) $(INCLS)
FreeImage: $(STATICLIB) $(SHAREDLIB)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
.cpp.o:
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
$(STATICLIB): $(MODULES)
$(AR) r $@ $(MODULES)
$(SHAREDLIB): $(MODULES)
$(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
install:
install -d $(INCDIR) $(INSTALLDIR)
install -m 644 -o root -g root $(HEADER) $(INCDIR)
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
# ldconfig
clean:
rm -f Dist/lib$(TARGET)* Dist/FreeImage.h $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)