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

Revision 2775, 4.8 kB (checked in by amerzky, 1 year ago)

add objects from external to lite
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 ifdef SAGA_ROOT
51   TMP_MAKE_INCLUDES = $(foreach preq,$(TMP_PACKAGE_REQS),$(SAGA_ROOT)/make/saga.$(preq).i.mk)
52 else
53   TMP_MAKE_INCLUDES = $(foreach preq,$(TMP_PACKAGE_REQS),$(SAGA_ROOT)/make/saga.$(preq).mk)
54 endif
55
56 TMP_MAKE_INCLUDES  += $(foreach ereq,$(TMP_EXTERNAL_REQS),$(SAGA_CONFDIR)/saga.config.$(ereq).c.mk)
57
58 ifneq "x$(TMP_MAKE_INCLUDES)" "x"
59   ifndef SAGA_IS_CLEANING
60     include $(TMP_MAKE_INCLUDES)
61   endif
62 endif
63
64
65 # check if that package types are enabled, and of pre-requisites are met
66 HAVE_PACKAGES=$(foreach p,$(SAGA_ADAPTOR_PACKAGES),$(SAGA_HAVE_PACKAGE_$(call saga_uc,$p)))
67 TMP_CHECK=$(strip $(patsubst yes,,$(HAVE_PACKAGES)))
68
69 ifeq "x$(TMP_CHECK)" "x"
70  
71 # check if we have the pre-requisits
72 # check_pre = $(or $(SAGA_HAVE_$(call saga_uc,$(1))) \
73 #                  $(SAGA_HAVE_INTERNAL_$(call saga_uc,$(1))) )
74   check_pre = $(SAGA_HAVE_$(call saga_uc,$(1)))$(SAGA_HAVE_INTERNAL_$(call saga_uc,$(1)))
75   check_sub = $(subst no,,$(call check_pre,$(1)))
76   check_req = $(if $(strip $(call check_sub,$(1))),, \
77                    SAGA_DISABLE_ADAPTOR:="$(SAGA_DISABLE_ADAPTOR) $(1)")
78   dummy = $(foreach req,          \
79             $(SAGA_ADAPTOR_REQUIREMENTS), \
80             $(call check_req,$(req)))
81 else
82         SAGA_DISABLE_ADAPTOR="one of the SAGA packages '$(call saga_uc,$(SAGA_NEED_PACKAGES))'"
83 endif
84 endif # guard
85
86 # this stupid construct prevents eval from beeing called
87 # with an ifdef'ed area, which is broken for make 3.80, at least on MacOS X...
88
89 dummy2 := $(eval $(dummy))
90
91 ifeq "$(SAGA_IS_CLEANING)" "yes"
92   SAGA_DISABLE_ADAPTOR =
93 endif
94
95
96 ifndef SAGA_MK_INC_ADAPTOR_2
97        SAGA_MK_INC_ADAPTOR_2 = yes
98
99
100
101 ifneq "$(SAGA_DISABLE_ADAPTOR)" ""
102  
103 include $(SAGA_MAKE_INCLUDE_ROOT)/saga.nothing.mk
104 nothing::
105           @$(ECHO) "      ======================================================"
106           @$(ECHO) "      the $(SAGA_ADAPTOR_NAME) adaptor is disabled."
107                 @$(ECHO) "      $(SAGA_DISABLE_ADAPTOR) missing"
108           @$(ECHO) "      ======================================================"
109
110 else
111
112 SAGA_ADP       = libsaga_adaptor_$(SAGA_ADAPTOR_NAME).$(SAGA_LEXT)
113 SAGA_ADP_STAT  = libsaga_adaptor_$(SAGA_ADAPTOR_NAME).$(SAGA_AEXT)
114 SAGA_ADP_ROOT  = $(SAGA_LOCATION)/lib/
115 SAGA_ADP_ROOTQ = "$$SAGA_LOCATION/lib/"
116 SAGA_ADP_INI   = saga_adaptor_$(SAGA_ADAPTOR_NAME).ini
117
118 SAGA_LIB       = saga_adaptor_$(SAGA_ADAPTOR_NAME)
119 SAGA_LIB_OBJ   = $(SAGA_ADAPTOR_OBJ)
120 SAGA_LIB_OBJC  = $(SAGA_ADAPTOR_OBJC)
121
122
123 include $(SAGA_MAKE_INCLUDE_ROOT)/saga.mk
124
125
126 ifdef SAGA_ROOT
127   SAGA_PACKAGE_INC = $(foreach p,$(SAGA_ADAPTOR_PACKAGES),$(SAGA_MAKE_INCLUDE_ROOT)/saga.package.$p.i.mk)
128 else
129   SAGA_PACKAGE_INC = $(foreach p,$(SAGA_ADAPTOR_PACKAGES),$(SAGA_MAKE_INCLUDE_ROOT)/saga.package.$p.mk)
130 endif
131
132 ifneq "$(SAGA_PACKAGE_INC)" ""
133   ifndef SAGA_IS_CLEANING
134     include $(SAGA_PACKAGE_INC)
135   endif
136 endif
137
138
139 all:: $(SAGA_ADP) $(SAGA_ADP_STAT)
140
141 install:: all forceinstall
142
143 .PHONY: forceinstall
144 forceinstall:: subdirs
145         @$(ECHO) "      installing   adaptor ini"
146         @$(MKDIR)                    $(SAGA_INI_ROOT)
147         @$(CP)   $(SAGA_ADAPTOR_INI) $(SAGA_INI_ROOT)/$(SAGA_ADP_INI)
148
149 ifdef SAGA_ROOT
150
151  SAGA_LITE_TYPE        = ADAPTOR
152  SAGA_LITE_NAME        = $(SAGA_ADAPTOR_NAME)
153  SAGA_LITE_DEPS        = $(SAGA_ADAPTOR_PACKAGES)
154  
155  include $(SAGA_ROOT)/make/saga.mklite.mk
156
157 endif
158
159
160 clean::
161         -@$(RM)    $(SAGA_ADP) $(SAGA_ADP_STAT)
162
163 SAGA_CPPDEFS  += -DSAGA_ADAPTOR_NAME=$(SAGA_ADAPTOR_NAME)
164
165 ifdef SAGA_ROOT
166  SAGA_CPPINCS  += -I$(SAGA_ROOT)/test/
167  SAGA_LDFLAGS  += -L$(SAGA_ROOT)/saga/impl/engine -lsaga_engine
168 else
169  SAGA_CPPINCS  += -I$(SAGA_LOCATION)/include/saga/
170  SAGA_LDFLAGS  += -L$(SAGA_LOCATION)/lib -lsaga_engine
171 endif
172
173 endif # package enabled
174
175 endif # guard
176
Note: See TracBrowser for help on using the browser.