about summary refs log tree commit diff
path: root/converter/other/jpeg2000/Makefile
blob: 4afe4ffddb2331049c175dd4493104d4eafc2374 (plain) (blame)
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
ifeq ($(SRCDIR)x,x)
  SRCDIR = $(CURDIR)/../../..
  BUILDDIR = $(SRCDIR)
endif
SUBDIR = converter/other/jpeg2000
VPATH=.:$(SRCDIR)/$(SUBDIR)

SUBDIRS = libjasper

include $(BUILDDIR)/config.mk

EXTERN_INCLUDES =
ifneq ($(JASPERHDR_DIR),NONE)
  EXTERN_INCLUDES += -I$(JASPERHDR_DIR)
endif


# INTERNAL_JASPERLIB must be relative to the current directory, because it
# may end up in MERGE_OBJECTS, which must be relative.
INTERNAL_JASPERLIB = libjasper/libjasper.a
INTERNAL_JASPERHDR_DIR = $(SRCDIR)/$(SUBDIR)/libjasper/include

ifeq ($(JASPERLIB),$(INTERNAL_JASPERLIB))
  ifeq ($(HAVE_INT64),Y)
    JASPERLIB_DEP = $(JASPERLIB)
    JASPERLIB_USE = $(JASPERLIB)
  else
    # He wants the internal library, but doesn't have a 64 bit compiler,
    # so we have no way to build it.  Ergo, he doesn't have a Jasper
    # library.
    JASPERLIB_USE = NONE
  endif
else
  # It's not our internal version; user's on his own to make sure it's built
  JASPERLIB_USE = $(JASPERLIB)
endif


ifneq ($(JASPERHDR_DIR),NONE)
  ifneq ($(JASPERLIB_USE),NONE)
    PORTBINARIES = pamtojpeg2k jpeg2ktopam
  endif
endif

BINARIES = $(PORTBINARIES)

OBJECTS = $(BINARIES:%=%.o)
MERGE_OBJECTS = $(BINARIES:%=%.o2) 
ifeq ($(JASPERLIB),$(INTERNAL_JASPERLIB))
  # MERGE_OBJECTS contains relative paths, so $(INTERNAL_JASPERLIB) had better
  # be relative to the current directory.
  MERGE_OBJECTS += $(JASPERLIB)
endif
MERGEBINARIES = $(BINARIES)

.PHONY: all
all: $(BINARIES)

include $(SRCDIR)/common.mk

LIBOPTS = $(shell $(LIBOPT) $(JASPERLIB_USE))

$(BINARIES): %: %.o $(JASPERLIB_DEP) $(LIBOPT)
$(BINARIES): LDFLAGS_TARGET = $(LIBOPTS) $(JASPERDEPLIBS)

$(INTERNAL_JASPERLIB): $(BUILDDIR)/$(SUBDIR)/libjasper FORCE
	$(MAKE) -f $(SRCDIR)/$(SUBDIR)/libjasper/Makefile \
	   -C $(dir $@) $(notdir $@)

.PHONY: FORCE
FORCE: