summaryrefslogtreecommitdiff
blob: 4dfe8928f28d878cf42525d150e51afe9fca9132 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
--- genfipsrclist.sh
+++ genfipsrclist.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibMNG Source/LibPNG Source/LibTIFF Source/ZLib Wrapper/FreeImagePlus"
+DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Wrapper/FreeImagePlus"
 
 echo "VER_MAJOR = 3" > fipMakefile.srcs
 echo "VER_MINOR = 9.3" >> fipMakefile.srcs
@@ -12,7 +12,7 @@
 		egrep 'RelativePath=.*\.(c|cpp)' $DIR/*.vcproj | cut -d'"' -f2 | tr '\\' '/' | awk '{print "'$DIR'/"$0}' | tr '\r\n' '  ' | tr -s ' ' >> fipMakefile.srcs
 	fi
 done
-echo >> fipMakefile.srcs
+echo Source/LibJPEG/transupp.c >> fipMakefile.srcs
 
 echo -n "INCLUDE =" >> fipMakefile.srcs
 for DIR in $DIRLIST; do
--- gensrclist.sh
+++ gensrclist.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibMNG Source/LibPNG Source/LibTIFF Source/ZLib"
+DIRLIST=". Source Source/Metadata Source/FreeImageToolkit"
 
 echo "VER_MAJOR = 3" > Makefile.srcs
 echo "VER_MINOR = 9.3" >> Makefile.srcs
@@ -12,7 +12,7 @@
 		egrep 'RelativePath=.*\.(c|cpp)' $DIR/*.vcproj | cut -d'"' -f2 | tr '\\' '/' | awk '{print "'$DIR'/"$0}' | tr '\r\n' '  ' | tr -s ' ' >> Makefile.srcs
 	fi
 done
-echo >> Makefile.srcs
+echo Source/LibJPEG/transupp.c >> Makefile.srcs
 
 echo -n "INCLS = " >> Makefile.srcs
 find . -name "*.h" -print | xargs echo >> Makefile.srcs
--- Makefile
+++ Makefile
@@ -14,8 +14,11 @@
     MAKEFILE = solaris
 endif
 
+FLAGS = -Wall -fPIC
+LIBS = -lstdc++ -lpng -lmng -ltiff -ljpeg
 default:
-	$(MAKE) -f Makefile.$(MAKEFILE) 
+	$(MAKE) CC="$(CC)" CXX="$(CXX)" AR="$(AR)" COMPILERFLAGS="$(FLAGS)" LIBRARIES="$(LIBS)" -f Makefile.gnu
+	$(MAKE) CC="$(CC)" CXX="$(CXX)" AR="$(AR)" COMPILERFLAGS="$(FLAGS)" LIBRARIES="$(LIBS)" -f Makefile.fip
 
 all:
 	$(MAKE) -f Makefile.$(MAKEFILE) all 
@@ -24,7 +27,8 @@
 	$(MAKE) -f Makefile.$(MAKEFILE) dist 
 
 install:
-	$(MAKE) -f Makefile.$(MAKEFILE) install 
+	$(MAKE) -f Makefile.gnu install
+	$(MAKE) -f Makefile.fip install
 
 clean:
 	$(MAKE) -f Makefile.$(MAKEFILE) clean 
--- Makefile.fip
+++ Makefile.fip
@@ -19,8 +19,8 @@
 
 MODULES = $(SRCS:.c=.o)
 MODULES := $(MODULES:.cpp=.o)
-CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
-CXXFLAGS = $(COMPILERFLAGS) -Wno-ctor-dtor-privacy $(INCLUDE)
+CFLAGS += $(COMPILERFLAGS) $(INCLUDE)
+CXXFLAGS += $(COMPILERFLAGS) -Wno-ctor-dtor-privacy $(INCLUDE)
 
 TARGET  = freeimageplus
 STATICLIB = lib$(TARGET).a
@@ -56,16 +56,15 @@
 	$(AR) r $@ $(MODULES)
 
 $(SHAREDLIB): $(MODULES)
-	$(CC) -s -shared -Wl,-soname,$(VERLIBNAME) -o $@ $(MODULES) $(LIBRARIES)
+	$(CC) $(LDFLAGS) -shared -Wl,-soname,$(VERLIBNAME) -o $@ $(MODULES) $(LIBRARIES)
 
 install:
-	install -m 644 -o root -g root $(HEADER) $(INCDIR)
-	install -m 644 -o root -g root $(HEADERFIP) $(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
+	install -m 644 $(HEADER) $(DESTDIR)/$(INCDIR)
+	install -m 644 $(HEADERFIP) $(DESTDIR)/$(INCDIR)
+	install -m 644 $(STATICLIB) $(DESTDIR)/$(LIBDIR)
+	install -m 755 $(SHAREDLIB) $(DESTDIR)/$(LIBDIR)
+	ln -sf $(SHAREDLIB) $(DESTDIR)/$(LIBDIR)/$(VERLIBNAME)
+	ln -sf $(VERLIBNAME) $(DESTDIR)/$(LIBDIR)/$(LIBNAME)
 
 clean:
 	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
--- Makefile.gnu
+++ Makefile.gnu
@@ -19,8 +19,8 @@
 
 MODULES = $(SRCS:.c=.o)
 MODULES := $(MODULES:.cpp=.o)
-CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
-CXXFLAGS = $(COMPILERFLAGS)  -Wno-ctor-dtor-privacy $(INCLUDE)
+CFLAGS += $(COMPILERFLAGS) $(INCLUDE)
+CXXFLAGS += $(COMPILERFLAGS) -Wno-ctor-dtor-privacy $(INCLUDE)
 
 TARGET  = freeimage
 STATICLIB = lib$(TARGET).a
@@ -55,15 +55,15 @@
 	$(AR) r $@ $(MODULES)
 
 $(SHAREDLIB): $(MODULES)
-	$(CC) -s -shared -Wl,-soname,$(VERLIBNAME) -o $@ $(MODULES) $(LIBRARIES)
+	$(CC) $(LDFLAGS) -shared -Wl,-soname,$(VERLIBNAME) -o $@ $(MODULES) $(LIBRARIES)
 
 install:
-	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
+	install -d $(DESTDIR)/$(INCDIR) $(DESTDIR)/$(LIBDIR)
+	install -m 644 $(HEADER) $(DESTDIR)/$(INCDIR)
+	install -m 644 $(STATICLIB) $(DESTDIR)/$(LIBDIR)
+	install -m 755 $(SHAREDLIB) $(DESTDIR)/$(LIBDIR)
+	ln -sf $(SHAREDLIB) $(DESTDIR)/$(LIBDIR)/$(VERLIBNAME)
+	ln -sf $(VERLIBNAME) $(DESTDIR)/$(LIBDIR)/$(LIBNAME)
 
 clean:
 	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)