Removed LCMS dependencies from Makefile.am/Makefile.nix
[openjpeg.git] / Makefile.nix
1 #top Makefile.nix
2 include  config.nix
3
4 TARGET  = openjpeg
5 COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
6
7 INCLUDE = -I. -Ilibopenjpeg
8 LIBRARIES = -lstdc++
9
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 \
16
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
25
26 INSTALL_LIBDIR = $(prefix)/lib
27 headerdir = openjpeg-$(MAJOR).$(MINOR)
28 INSTALL_INCLUDE = $(prefix)/include/$(headerdir)
29
30 # Converts cr/lf to just lf
31 DOS2UNIX = dos2unix
32
33 MODULES = $(SRCS:.c=.o)
34
35 CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
36
37 LIBNAME = lib$(TARGET)
38 STATICLIB = $(LIBNAME).a
39
40 ifeq ($(ENABLE_SHARED),yes)
41 SHAREDLIB = $(LIBNAME).so.$(MAJOR).$(MINOR).$(BUILD)
42 endif
43
44 default: all
45
46 all: OpenJPEG
47         make -C codec -f Makefile.nix all
48         make -C mj2 -f Makefile.nix all
49 ifeq ($(WITH_JPWL),yes)
50         make -C jpwl -f Makefile.nix all
51 endif
52 ifeq ($(WITH_JP3D),yes)
53         make -C jp3d -f Makefile.nix all
54 endif
55
56 dos2unix:
57         @$(DOS2UNIX) $(SRCS) $(INCLS)
58
59 OpenJPEG: $(STATICLIB) $(SHAREDLIB)
60         install -d bin
61         install -m 644 $(STATICLIB) bin
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 $(LIBNAME).so.$(MAJOR).$(MINOR) $(LIBNAME).so)
66 endif
67
68 .c.o:
69         $(CC) $(CFLAGS) -c $< -o $@
70
71 $(STATICLIB): $(MODULES)
72         rm -f $(STATICLIB)
73         $(AR) r $@ $(MODULES)
74
75 ifeq ($(ENABLE_SHARED),yes)
76 $(SHAREDLIB): $(MODULES)
77         $(CC) -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
78 endif
79
80 install: OpenJPEG
81         install -d $(DESTDIR)$(INSTALL_LIBDIR) 
82         install -m 644 -o root -g root $(STATICLIB) $(DESTDIR)$(INSTALL_LIBDIR)
83         (cd $(DESTDIR)$(INSTALL_LIBDIR) && ranlib $(STATICLIB) )
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 $(LIBNAME).so.$(MAJOR).$(MINOR) $(LIBNAME).so )
90 endif
91         install -d $(DESTDIR)$(INSTALL_INCLUDE)
92         install -m 644 -o root -g root libopenjpeg/openjpeg.h \
93         $(DESTDIR)$(INSTALL_INCLUDE)
94         (cd $(DESTDIR)$(prefix)/include && \
95         ln -sf $(headerdir)/openjpeg.h openjpeg.h)
96         make -C codec -f Makefile.nix install
97         make -C mj2 -f Makefile.nix install
98 ifeq ($(WITH_JPWL),yes)
99         make -C jpwl -f Makefile.nix install
100 endif
101 ifeq ($(WITH_JP3D),yes)
102         make -C jp3d -f Makefile.nix install
103 endif
104         $(LDCONFIG)
105         make -C doc -f Makefile.nix install
106
107 ifeq ($(WITH_JPWL),yes)
108 jpwl-all:
109         make -C jpwl -f Makefile.nix all
110
111 jpwl-install: jpwl-all
112         make -C jpwl -f Makefile.nix install
113         $(LDCONFIG)
114
115 jpwl-clean:
116         make -C jpwl -f Makefile.nix clean
117
118 jpwl-uninstall:
119         make -C jpwl -f Makefile.nix uninstall
120 endif
121
122 ifeq ($(WITH_JP3D),yes)
123 jp3d-all:
124         make -C jp3d -f Makefile.nix all
125
126 jp3d-install: jp3d-all
127         make -C jp3d -f Makefile.nix install
128         $(LDCONFIG)
129
130 jp3d-clean:
131         make -C jp3d -f Makefile.nix clean
132
133 jp3d-uninstall:
134         make -C jp3d -f Makefile.nix uninstall
135 endif
136
137 doc-all:
138         make -C doc -f Makefile.nix all
139
140 doc-install: doc-all
141         make -C doc -f Makefile.nix install
142
143 clean:
144         rm -rf bin
145         rm -f core u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB)
146         make -C codec -f Makefile.nix clean
147         make -C mj2 -f Makefile.nix clean
148         make -C doc -f Makefile.nix clean
149 ifeq ($(WITH_JPWL),yes)
150         make -C jpwl -f Makefile.nix clean
151 endif
152 ifeq ($(WITH_JP3D),yes)
153         make -C jp3d -f Makefile.nix clean
154 endif
155
156 doc-clean:
157         make -C doc -f Makefile.nix clean
158
159 uninstall:
160         rm -f $(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)
161 ifeq ($(ENABLE_SHARED),yes)
162         (cd $(DESTDIR)$(INSTALL_LIBDIR) && \
163         rm -f $(LIBNAME).so $(LIBNAME).so.$(MAJOR).$(MINOR) $(SHAREDLIB) )
164 endif
165         $(LDCONFIG)
166         rm -f $(DESTDIR)$(prefix)/include/openjpeg.h
167         rm -rf $(DESTDIR)$(INSTALL_INCLUDE)
168         make -C codec -f Makefile.nix uninstall
169         make -C mj2 -f Makefile.nix uninstall
170         make -C doc -f Makefile.nix uninstall
171 ifeq ($(WITH_JPWL),yes)
172         make -C jpwl -f Makefile.nix uninstall
173 endif
174 ifeq ($(WITH_JP3D),yes)
175         make -C jp3d -f Makefile.nix uninstall
176 endif