media-libs/libschrift: add
[sgilles-overlay.git] / media-gfx / sjpeg / files / Makefile
blob0568ee795a91812b204e5e2daa5fff5d7e377783
1 .SUFFIXES:
2 .SUFFIXES: .o .cc
4 CXXFLAGS ?=
5 LDFLAGS ?=
6 PKG_CONFIG ?= pkg-config
7 AR ?= ar
8 ARFLAGS ?= rcs
10 PREFIX ?= /usr
11 BINDIR ?= $(PREFIX)/bin
12 SHAREDIR ?= $(PREFIX)/share
13 MANDIR ?= $(SHAREDIR)/man
14 LIBDIR ?= $(PREFIX)/lib
15 INCDIR ?= $(PREFIX)/include
17 CXXFLAGS += -std=c++14
19 CXXFLAGS += -pthread
21 VMAJOR=0
22 VMINOR=1
24 # most libs
25 CXXFLAGS += $(shell $(PKG_CONFIG) --cflags libjpeg libpng gl glut zlib)
26 LDFLAGS += $(shell $(PKG_CONFIG) --libs libjpeg libpng gl glut zlib)
28 default: all
29 all: \
30 sjpeg \
31 vjpeg \
32 sharedlib \
35 %.o: src/%.cc
36 $(CXX) $(CXXFLAGS) -fPIC -c -o $@ $<
38 %.o: examples/%.cc
39 $(CXX) $(CXXFLAGS) -Isrc -c -o $@ $<
41 sjpeg: sharedlib sjpeg.o utils.o
42 $(CXX) $(CXXFLAGS) -o $@ sjpeg.o utils.o $(LDFLAGS) -L. -Wl,--as-needed -lsjpeg
44 vjpeg: sharedlib vjpeg.o utils.o
45 $(CXX) $(CXXFLAGS) -o $@ vjpeg.o utils.o $(LDFLAGS) -L. -Wl,--as-needed -lsjpeg
47 .PHONY: sharedlib
48 sharedlib: bit_writer.o colors_rgb.o dichotomy.o enc.o fdct.o headers.o jpeg_tools.o score_7.o yuv_convert.o
49 $(CXX) -fPIC $(CXXFLAGS) -Wl,--as-needed -shared -Wl,-soname=libsjpeg.so.$(VMAJOR).$(VMINOR) -o libsjpeg.so.$(VMAJOR).$(VMINOR) $^ $(LDFLAGS)
50 ln -sf libsjpeg.so.$(VMAJOR).$(VMINOR) libsjpeg.so.$(VMAJOR)
51 ln -sf libsjpeg.so.$(VMAJOR).$(VMINOR) libsjpeg.so
53 .PHONY: clean
54 clean:
55 find -name '*.o' -delete
56 find -name sjpeg -delete
57 find -name vjpeg -delete
58 find -name libsjpeg.so -delete
59 find -name libsjpeg.so.$(VMAJOR) -delete
60 find -name libsjpeg.so.$(VMAJOR).$(VMINOR) -delete
62 .PHONY: install
63 install: all
64 mkdir -p $(DESTDIR)$(BINDIR)
65 cp -f sjpeg $(DESTDIR)$(BINDIR)
66 cp -f vjpeg $(DESTDIR)$(BINDIR)
67 mkdir -p $(DESTDIR)$(MANDIR)/man1
68 cp -f man/sjpeg.1 $(DESTDIR)$(MANDIR)/man1
69 cp -f man/vjpeg.1 $(DESTDIR)$(MANDIR)/man1
70 mkdir -p $(DESTDIR)$(LIBDIR)
71 cp -f libsjpeg.so $(DESTDIR)$(LIBDIR)
72 cp -f libsjpeg.so.$(VMAJOR) $(DESTDIR)$(LIBDIR)
73 cp -f libsjpeg.so.$(VMAJOR).$(VMINOR) $(DESTDIR)$(LIBDIR)
74 mkdir -p $(DESTDIR)$(INCDIR)
75 cp -f src/sjpeg.h $(DESTDIR)$(INCDIR)