5 COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
7 INCLUDE = -I. -Ilibopenjpeg
10 SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c \
11 ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c \
12 ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c \
13 ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c \
14 ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c \
15 ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c \
17 INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h \
18 ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h \
19 ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h \
20 ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h \
21 ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h \
22 ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h \
23 ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_malloc.h \
24 ./libopenjpeg/opj_includes.h
26 INSTALL_LIBDIR = $(prefix)/lib
27 headerdir = openjpeg-$(MAJOR).$(MINOR)
28 INSTALL_INCLUDE = $(prefix)/include/$(headerdir)
30 # Converts cr/lf to just lf
33 MODULES = $(SRCS:.c=.o)
35 CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
37 LIBNAME = lib$(TARGET)
39 ifeq ($(ENABLE_SHARED),yes)
40 SHAREDLIB = $(LIBNAME).so.$(MAJOR).$(MINOR).$(BUILD)
42 STATICLIB = $(LIBNAME).a
48 make -C codec -f Makefile.nix all
49 make -C mj2 -f Makefile.nix all
50 ifeq ($(WITH_JPWL),yes)
51 make -C jpwl -f Makefile.nix all
53 ifeq ($(WITH_JP3D),yes)
54 make -C jp3d -f Makefile.nix all
58 @$(DOS2UNIX) $(SRCS) $(INCLS)
60 OpenJPEG: $(STATICLIB) $(SHAREDLIB)
62 ifeq ($(ENABLE_SHARED),yes)
63 install -m 755 $(SHAREDLIB) bin
64 (cd bin && ln -sf $(SHAREDLIB) $(LIBNAME).so.$(MAJOR).$(MINOR))
65 (cd bin && ln -sf $(SHAREDLIB) $(LIBNAME).so)
67 install -m 644 $(STATICLIB) bin
71 $(CC) $(CFLAGS) -c $< -o $@
73 ifeq ($(ENABLE_SHARED),yes)
74 $(SHAREDLIB): $(MODULES)
75 $(CC) -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
77 $(STATICLIB): $(MODULES)
83 install -d $(DESTDIR)$(INSTALL_LIBDIR)
84 ifeq ($(ENABLE_SHARED),yes)
85 install -m 755 -o root -g root $(SHAREDLIB) $(DESTDIR)$(INSTALL_LIBDIR)
86 (cd $(DESTDIR)$(INSTALL_LIBDIR) && \
87 ln -sf $(SHAREDLIB) $(LIBNAME).so.$(MAJOR).$(MINOR) )
88 (cd $(DESTDIR)$(INSTALL_LIBDIR) && \
89 ln -sf $(SHAREDLIB) $(LIBNAME).so )
91 install -m 644 -o root -g root $(STATICLIB) $(DESTDIR)$(INSTALL_LIBDIR)
92 (cd $(DESTDIR)$(INSTALL_LIBDIR) && ranlib $(STATICLIB) )
94 install -d $(DESTDIR)$(INSTALL_INCLUDE)
95 install -m 644 -o root -g root libopenjpeg/openjpeg.h \
96 $(DESTDIR)$(INSTALL_INCLUDE)
97 (cd $(DESTDIR)$(prefix)/include && \
98 ln -sf $(headerdir)/openjpeg.h openjpeg.h)
99 make -C codec -f Makefile.nix install
100 make -C mj2 -f Makefile.nix install
101 ifeq ($(WITH_JPWL),yes)
102 make -C jpwl -f Makefile.nix install
104 ifeq ($(WITH_JP3D),yes)
105 make -C jp3d -f Makefile.nix install
108 make -C doc -f Makefile.nix install
110 ifeq ($(WITH_JPWL),yes)
112 make -C jpwl -f Makefile.nix all
114 jpwl-install: jpwl-all
115 make -C jpwl -f Makefile.nix install
119 make -C jpwl -f Makefile.nix clean
122 make -C jpwl -f Makefile.nix uninstall
125 ifeq ($(WITH_JP3D),yes)
127 make -C jp3d -f Makefile.nix all
129 jp3d-install: jp3d-all
130 make -C jp3d -f Makefile.nix install
134 make -C jp3d -f Makefile.nix clean
137 make -C jp3d -f Makefile.nix uninstall
141 make -C doc -f Makefile.nix all
144 make -C doc -f Makefile.nix install
148 rm -f core u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB)
149 make -C codec -f Makefile.nix clean
150 make -C mj2 -f Makefile.nix clean
151 make -C doc -f Makefile.nix clean
152 ifeq ($(WITH_JPWL),yes)
153 make -C jpwl -f Makefile.nix clean
155 ifeq ($(WITH_JP3D),yes)
156 make -C jp3d -f Makefile.nix clean
160 make -C doc -f Makefile.nix clean
163 ifeq ($(ENABLE_SHARED),yes)
164 (cd $(DESTDIR)$(INSTALL_LIBDIR) && \
165 rm -f $(LIBNAME).so $(LIBNAME).so.$(MAJOR).$(MINOR) $(SHAREDLIB) )
167 rm -f $(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)
170 rm -f $(DESTDIR)$(prefix)/include/openjpeg.h
171 rm -rf $(DESTDIR)$(INSTALL_INCLUDE)
172 make -C codec -f Makefile.nix uninstall
173 make -C mj2 -f Makefile.nix uninstall
174 make -C doc -f Makefile.nix uninstall
175 ifeq ($(WITH_JPWL),yes)
176 make -C jpwl -f Makefile.nix uninstall
178 ifeq ($(WITH_JP3D),yes)
179 make -C jp3d -f Makefile.nix uninstall