Commits

Christian Heimes committed c89e88d Draft

Integrated LibJPEGTurbo into Makefile.gnu

  • Participants
  • Parent commits a6ac380

Comments (0)

Files changed (1)

 	CXXFLAGS += -fPIC
 endif
 
-TARGET  = freeimage
+TARGET  = freeimageturbo
 STATICLIB = lib$(TARGET).a
 SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
 LIBNAME	= lib$(TARGET).so
 VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
 HEADER = Source/FreeImage.h
 
+LIBJPEGTURBO_A = Source/LibJPEGTurbo/.libs/libturbojpeg.a
+LIBJPEGTURBO_O = libjpegturbo
+LIBJPEGTURBO_H = Source/LibJPEGTurbo/jconfig.h
 
 
 default: all
 .cpp.o:
 	$(CXX) $(CXXFLAGS) -c $< -o $@
 
-$(STATICLIB): $(MODULES)
+$(MODULES): $(LIBJPEGTURBO_H)
+
+# turbojpeg first, FreeImage depends on generated header files
+$(STATICLIB): $(LIBJPEGTURBO_A) $(MODULES)
 	$(AR) r $@ $(MODULES)
+	mkdir -p $(LIBJPEGTURBO_O)
+	cd $(LIBJPEGTURBO_O); $(AR) x ../$(LIBJPEGTURBO_A)
+	$(AR) -r $@ $(LIBJPEGTURBO_O)/*.o
 
-$(SHAREDLIB): $(MODULES)
-	$(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+$(SHAREDLIB): $(LIBJPEGTURBO_A) $(MODULES)
+	$(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBJPEGTURBO_O)/*.o  $(LIBRARIES)
 
 install:
 	install -d $(INCDIR) $(INSTALLDIR)
 	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
 	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
 	ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)	
-#	ldconfig
+	ldconfig
 
 clean:
 	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+	if [ -e Source/LibJPEGTurbo/Makefile ]; then make -C Source/LibJPEGTurbo distclean; fi
+	rm -rf $(LIBJPEGTURBO_O) $(LIBJPEGTURBO_A) $(LIBJPEGTURBO_H)
 
+$(LIBJPEGTURBO_H):
+	cd Source/LibJPEGTurbo && ./configure --disable-shared --enable-static --with-jpeg8 --with-pic
+
+$(LIBJPEGTURBO_A): $(LIBJPEGTURBO_H)
+	cd Source/LibJPEGTurbo && $(MAKE)
+