diff options
Diffstat (limited to 'GNUmakefile')
-rw-r--r-- | GNUmakefile | 215 |
1 files changed, 215 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..f7f86d9 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,215 @@ +# config +srcdir = . +VPATH = $(srcdir) +-include Make.config +include $(srcdir)/mk/Variables.mk + +resdir = $(DESTDIR)$(RESDIR) + +# fixup flags +CFLAGS += -DVERSION='"$(VERSION)"' -I$(srcdir) + +# default target +all: build + +# what to build +TARGETS := exiftran thumbnail.cgi +ifeq ($(HAVE_LINUX_FB_H),yes) + TARGETS += fbi +endif +ifeq ($(HAVE_MOTIF),yes) + TARGETS += ida +endif + + +################################################################# +# poor man's autoconf ;-) + +include $(srcdir)/mk/Autoconf.mk + +define make-config +LIB := $(LIB) +RESDIR := $(call ac_resdir) +HAVE_ENDIAN_H := $(call ac_header,endian.h) +HAVE_LINUX_FB_H := $(call ac_header,linux/fb.h) +HAVE_GLIBC := $(call ac_func,fopencookie) +HAVE_STRCASESTR := $(call ac_func,strcasestr) +HAVE_LIBPCD := $(call ac_lib,pcd_open,pcd) +HAVE_LIBUNGIF := $(call ac_lib,DGifOpenFileName,ungif) +HAVE_LIBPNG := $(call ac_lib,png_read_info,png,-lz) +HAVE_LIBTIFF := $(call ac_lib,TIFFOpen,tiff) +#HAVE_LIBMAGICK := $(call ac_binary,Magick-config) +HAVE_LIBSANE := $(call ac_lib,sane_init,sane) +HAVE_LIBCURL := $(call ac_lib,curl_easy_init,curl) +HAVE_LIBLIRC := $(call ac_lib,lirc_init,lirc_client) +HAVE_MOTIF := $(call ac_lib,XmStringGenerate,Xm,-L/usr/X11R6/$(LIB) -lXpm -lXt -lXext -lX11) +endef + +# transparent http/ftp access using curl depends on fopencookie (glibc) +ifneq ($(HAVE_GLIBC),yes) + HAVE_LIBCURL := no +endif + +# catch fopen calls for transparent ftp/http access +ifeq ($(HAVE_LIBCURL),yes) + ida fbi : CFLAGS += -D_GNU_SOURCE + ida fbi : LDFLAGS += -Wl,--wrap=fopen +endif + + +######################################################################## +# conditional stuff + +includes = ENDIAN_H STRCASESTR +libraries = PCD UNGIF PNG TIFF CURL SANE LIRC +ida_libs = PCD UNGIF PNG TIFF CURL SANE +fbi_libs = PCD UNGIF PNG TIFF CURL LIRC + +#MAGICK_CFLAGS = $(shell Magick-config --cflags) +#MAGICK_LDFLAGS = $(shell Magick-config --ldflags) +#MAGICK_LDLIBS = $(shell Magick-config --libs) +#MAGICK_OBJS := rd/magick.o + +PNG_LDLIBS := -lpng -lz +TIFF_LDLIBS := -ltiff +PCD_LDLIBS := -lpcd +UNGIF_LDLIBS := -lungif +SANE_LDLIBS := -lsane +CURL_LDLIBS := -lcurl +LIRC_LDLIBS := -llirc_client + +PNG_OBJS := rd/read-png.o wr/write-png.o +TIFF_OBJS := rd/read-tiff.o wr/write-tiff.o +PCD_OBJS := rd/read-pcd.o +UNGIF_OBJS := rd/read-gif.o +SANE_OBJS := sane.o +CURL_OBJS := curl.o +LIRC_OBJS := lirc.o + +# common objs +OBJS_READER := readers.o rd/read-ppm.o rd/read-bmp.o rd/read-jpeg.o +OBJS_WRITER := writers.o wr/write-ppm.o wr/write-ps.o wr/write-jpeg.o + +# update various flags depending on HAVE_* +CFLAGS += $(call ac_inc_cflags,$(includes)) +CFLAGS += $(call ac_lib_cflags,$(libraries)) +CFLAGS += $(call ac_lib_mkvar,$(libraries),CFLAGS) +LDFLAGS += $(call ac_lib_mkvar,$(libraries),LDFLAGS) + +# link which conditional libs +ida : LDLIBS += $(call ac_lib_mkvar,$(ida_libs),LDLIBS) +fbi : LDLIBS += $(call ac_lib_mkvar,$(fbi_libs),LDLIBS) + + +######################################################################## +# rules for the small tools + +# jpeg/exif libs +exiftran : LDLIBS += -ljpeg -lexif -lm +genthumbnail : LDLIBS += -ljpeg -lexif -lm +thumbnail.cgi : LDLIBS += -lexif -lm + +exiftran: exiftran.o genthumbnail.o jpegtools.o jpeg/transupp.o \ + filter.o op.o readers.o rd/read-jpeg.o +thumbnail.cgi: thumbnail.cgi.o + + +######################################################################## +# rules for ida + +# object files +OBJS_IDA := \ + ida.o man.o hex.o x11.o viewer.o dither.o icons.o \ + parseconfig.o idaconfig.o fileops.o desktop.o \ + RegEdit.o selections.o xdnd.o jpeg/transupp.o \ + filebutton.o filelist.o browser.o jpegtools.o \ + op.o filter.o lut.o color.o \ + rd/read-xwd.o rd/read-xpm.o + +OBJS_IDA += $(call ac_lib_mkvar,$(ida_libs),OBJS) + +# for X11 + Motif +ida : CFLAGS += -I/usr/X11R6/include +ida : LDFLAGS += -L/usr/X11R6/$(LIB) +ida : LDLIBS += -lXm -lXpm -lXt -lXext -lX11 + +# jpeg/exif libs +ida : LDLIBS += -ljpeg -lexif -lm + +# RegEdit.c is good old K&R ... +RegEdit.o : CFLAGS += -Wno-missing-prototypes -Wno-strict-prototypes + +ida: $(OBJS_IDA) $(OBJS_READER) $(OBJS_WRITER) + +Ida.ad.h: Ida.ad $(srcdir)/fallback.pl + perl $(srcdir)/fallback.pl < $< > $@ + +logo.h: logo.jpg + hexdump -v -e '1/1 "0x%02x,"' < $< > $@ + echo >> $@ # make gcc 3.x happy + +ida.o: Ida.ad.h logo.h + + +######################################################################## +# rules for fbi + +# object files +OBJS_FBI := \ + fbi.o fbtools.o fs.o fb-gui.o desktop.o \ + jpegtools.o jpeg/transupp.o \ + dither.o filter.o op.o + +OBJS_FBI += $(filter-out wr/%,$(call ac_lib_mkvar,$(fbi_libs),OBJS)) + +# jpeg/exif libs +fbi : LDLIBS += -ljpeg -lexif -lm +fs.o fb-gui.o : CFLAGS += -DX_DISPLAY_MISSING=1 + +fbi: $(OBJS_FBI) $(OBJS_READER) + + +######################################################################## +# general rules + +.PHONY: build install clean distclean realclean +build: $(TARGETS) + +install: build + $(INSTALL_DIR) $(bindir) + $(INSTALL_DIR) $(mandir)/man1 + $(INSTALL_BINARY) exiftran $(bindir) + $(INSTALL_DATA) $(srcdir)/exiftran.man $(mandir)/man1/exiftran.1 +ifeq ($(HAVE_LINUX_FB_H),yes) + $(INSTALL_BINARY) fbi fbgs $(bindir) + $(INSTALL_DATA) $(srcdir)/fbi.man $(mandir)/man1/fbi.1 + $(INSTALL_DATA) $(srcdir)/fbgs.man $(mandir)/man1/fbgs.1 +endif +ifeq ($(HAVE_MOTIF),yes) + $(INSTALL_BINARY) ida $(bindir) + $(INSTALL_DATA) $(srcdir)/ida.man $(mandir)/man1/ida.1 + $(INSTALL_DIR) $(resdir)/app-defaults + $(INSTALL_DATA) $(srcdir)/Ida.ad $(resdir)/app-defaults/Ida +endif + +clean: + -rm -f *.o jpeg/*.o rd/*.o wr/*.o $(depfiles) core core.* + +realclean distclean: clean + -rm -f Make.config + -rm -f $(TARGETS) *~ rd/*~ wr/*~ xpm/*~ Ida.ad.h logo.h + + +include $(srcdir)/mk/Compile.mk +-include $(depfiles) + + +######################################################################## +# maintainer stuff + +include $(srcdir)/mk/Maintainer.mk + +sync:: + cp $(srcdir)/../xawtv/common/parseconfig.[ch] $(srcdir) + cp $(srcdir)/../xawtv/console/fbtools.[ch] $(srcdir) + cp $(srcdir)/../xawtv/console/fs.[ch] $(srcdir) |