root/saga/trunk/make/saga.adaptor.mk

Revision 3482, 4.7 kB (checked in by amerzky, 9 months ago)

scattered commits, nothing important really
A

Line 
1 #  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
2 #
3 #  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 #  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 # vim: ft=make
7
8
9 ifndef SAGA_MK_INC_ADAPTOR
10        SAGA_MK_INC_ADAPTOR = yes
11
12 ###########################################################
13 #
14 # make configuration
15 #
16 -include $(SAGA_ROOT)/make/saga.util.mk
17 -include $(SAGA_LOCATION)/share/saga/make/saga.util.mk
18
19 ifndef SAGA_MAKE_INCLUDE_ROOT
20   $(error need either SAGA_ROOT or SAGA_LOCATION)
21 endif
22
23
24 ###########################################################
25 #
26 # make configuration for adaptor builds
27 #
28
29 ifndef SAGA_ADAPTOR_NAME
30   $(info make: )
31   $(info make:  -- Adaptor name not defined! -- )
32   $(info make: )
33   $(info make: SAGA_ADAPTOR_NAME must be set in Makefile)
34   $(info make: if saga.adaptor.mk is used.)
35   $(info make: )
36   $(error SAGA make error ***))
37 endif
38
39
40 # include the rquired make includes
41 ifndef SAGA_CONFDIR
42   SAGA_CONFDIR = ../config
43 endif
44
45 TMP_ADAPTOR_REQS    = $(patsubst   package_%,package.%,$(SAGA_ADAPTOR_REQUIREMENTS))
46 TMP_PACKAGE_REQS    = $(filter     package.%,$(TMP_ADAPTOR_REQS))
47 TMP_EXTERNAL_REQS   = $(filter-out package.%,$(TMP_ADAPTOR_REQS))
48
49
50 TMP_MAKE_INCLUDES = $(foreach preq,$(TMP_PACKAGE_REQS),$(SAGA_MAKE_INCLUDE_ROOT)/saga.$(preq).i.mk)
51
52 TMP_MAKE_INCLUDES  += $(foreach ereq,$(TMP_EXTERNAL_REQS),$(SAGA_CONFDIR)/saga.config.$(ereq).c.mk)
53
54 ifneq "x$(TMP_MAKE_INCLUDES)" "x"
55   ifndef SAGA_IS_CLEANING
56     include $(TMP_MAKE_INCLUDES)
57   endif
58 endif
59
60 # include for generating adaptor docs
61 include $(SAGA_MAKE_INCLUDE_ROOT)/saga.doc.mk
62
63
64 # check if that package types are enabled, and of pre-requisites are met
65 HAVE_PACKAGES=$(foreach p,$(SAGA_ADAPTOR_PACKAGES),$(SAGA_HAVE_PACKAGE_$(call saga_uc,$p)))
66 TMP_CHECK=$(strip $(patsubst yes,,$(HAVE_PACKAGES)))
67
68 ifeq "x$(TMP_CHECK)" "x"
69  
70 # check if we have the pre-requisits
71 # check_pre = $(or $(SAGA_HAVE_$(call saga_uc,$(1))) \
72 #                  $(SAGA_HAVE_INTERNAL_$(call saga_uc,$(1))) )
73   check_pre = $(SAGA_HAVE_$(call saga_uc,$(1)))$(SAGA_HAVE_INTERNAL_$(call saga_uc,$(1)))
74   check_sub = $(subst no,,$(call check_pre,$(1)))
75   check_req = $(if $(strip $(call check_sub,$(1))),, \
76                    SAGA_DISABLE_ADAPTOR:="$(SAGA_DISABLE_ADAPTOR) $(1)")
77   dummy = $(foreach req,          \
78             $(SAGA_ADAPTOR_REQUIREMENTS), \
79             $(call check_req,$(req)))
80 else
81         SAGA_DISABLE_ADAPTOR="one of the SAGA packages '$(call saga_uc,$(SAGA_NEED_PACKAGES))'"
82 endif
83 endif # guard
84
85 # this stupid construct prevents eval from beeing called
86 # with an ifdef'ed area, which is broken for make 3.80, at least on MacOS X...
87
88 dummy2 := $(eval $(dummy))
89
90 ifeq "$(SAGA_IS_CLEANING)" "yes"
91   SAGA_DISABLE_ADAPTOR =
92 endif
93
94
95 ifndef SAGA_MK_INC_ADAPTOR_2
96        SAGA_MK_INC_ADAPTOR_2 = yes
97
98
99
100 ifneq "$(SAGA_DISABLE_ADAPTOR)" ""
101  
102 include $(SAGA_MAKE_INCLUDE_ROOT)/saga.nothing.mk
103 nothing::
104           @$(ECHO) "      ======================================================"
105           @$(ECHO) "      the $(SAGA_ADAPTOR_NAME) adaptor is disabled."
106                 @$(ECHO) "      $(SAGA_DISABLE_ADAPTOR) missing"
107           @$(ECHO) "      ======================================================"
108
109 else
110
111 SAGA_ADP       = libsaga_adaptor_$(SAGA_ADAPTOR_NAME).$(SAGA_LEXT)
112 SAGA_ADP_STAT  = libsaga_adaptor_$(SAGA_ADAPTOR_NAME).$(SAGA_AEXT)
113 SAGA_ADP_ROOT  = $(SAGA_LOCATION)/lib/
114 SAGA_ADP_ROOTQ = "$$SAGA_LOCATION/lib/"
115 SAGA_ADP_INI   = saga_adaptor_$(SAGA_ADAPTOR_NAME).ini
116
117 SAGA_LIB       = saga_adaptor_$(SAGA_ADAPTOR_NAME)
118 SAGA_LIB_OBJ   = $(SAGA_ADAPTOR_OBJ)
119 SAGA_LIB_OBJC  = $(SAGA_ADAPTOR_OBJC)
120
121
122 include $(SAGA_MAKE_INCLUDE_ROOT)/saga.mk
123
124
125 ifdef SAGA_ROOT
126   SAGA_PACKAGE_INC = $(foreach p,$(SAGA_ADAPTOR_PACKAGES),$(SAGA_MAKE_INCLUDE_ROOT)/saga.package.$p.i.mk)
127 else
128   SAGA_PACKAGE_INC = $(foreach p,$(SAGA_ADAPTOR_PACKAGES),$(SAGA_MAKE_INCLUDE_ROOT)/saga.package.$p.mk)
129 endif
130
131 ifneq "$(SAGA_PACKAGE_INC)" ""
132   ifndef SAGA_IS_CLEANING
133     include $(SAGA_PACKAGE_INC)
134   endif
135 endif
136
137
138 all:: $(SAGA_ADP) $(SAGA_ADP_STAT)
139
140 install:: all forceinstall
141
142 .PHONY: forceinstall
143 forceinstall:: subdirs
144         @$(ECHO) "      installing   adaptor ini"
145         @$(MKDIR)                    $(SAGA_INI_ROOT)
146         @$(CP)   $(SAGA_ADAPTOR_INI) $(SAGA_INI_ROOT)/$(SAGA_ADP_INI)
147
148 ifdef SAGA_ROOT
149
150  SAGA_LITE_TYPE        = ADAPTOR
151  SAGA_LITE_NAME        = $(SAGA_ADAPTOR_NAME)
152  SAGA_LITE_DEPS        = $(SAGA_ADAPTOR_PACKAGES)
153  
154  include $(SAGA_ROOT)/make/saga.mklite.mk
155
156 endif
157
158
159 clean::
160         -@$(RM)    $(SAGA_ADP) $(SAGA_ADP_STAT)
161
162 SAGA_CPPDEFS  += -DSAGA_ADAPTOR_NAME=$(SAGA_ADAPTOR_NAME)
163
164 ifdef SAGA_ROOT
165  SAGA_CPPINCS  += -I$(SAGA_ROOT)/test/
166  SAGA_LDFLAGS  += -L$(SAGA_ROOT)/saga/impl/engine -lsaga_engine
167 else
168  SAGA_CPPINCS  += -I$(SAGA_LOCATION)/include/saga/
169  SAGA_LDFLAGS  += -L$(SAGA_LOCATION)/lib -lsaga_engine
170 endif
171
172 endif # package enabled
173
174 endif # guard
175
Note: See TracBrowser for help on using the browser.