Initial release of Maemo 5 port of gnuplot
[gnuplot] / src / beos / Makefile.in
1 ## BeOS Generic Makefile v2.0b3 ##
2
3 ## Fill in the top section of this makefile to define exactly what sort of
4 ## binary you are creating, and what sources, resources and libraries are
5 ## needed to create it.  The makefile will then determine the proper
6 ## platform specific options.
7
8 ## Fill in the top section to define the binary being created and the makefile
9 ## will make sure that all of the hard work is taken care of for you, for both
10 ## PowerPC and Intel versions of the BeOS.
11
12 ## Application Specific Settings ---------------------------------------------
13
14 # specify the name of the binary
15 NAME= gnuplot_be
16
17 # specify the type of binary
18 #       APP:    Application
19 #       SHARED: Shared library or add-on
20 #       STATIC: Static library archive
21 #       DRIVER: Kernel Driver
22 TYPE= APP
23
24 # specify the source files to use
25 #       full paths or paths relative to the makefile can be included
26 #       all files, regardless of directory, will have their object
27 #       files created in the common object directory.
28 #       Note that this means this makefile will not work correctly
29 #       if two source files with the same name (source.c or source.cpp)
30 #       are included from different directories.  Also note that spaces
31 #       in folder names do not work well with this makefile.
32 SOURCES= GPApp.cpp GPWindow.cpp GPView.cpp GPBitmap.cpp
33
34 HEADERS= GPApp.h GPBitmap.h GPView.h GPWindow.h XStringList.h constants.h
35
36 EXTRA_DIST= XStringList.cpp
37
38 # specify the resource files to use
39 #       full path or a relative path to the resource file can be used.
40 RSRCS= gnuplot_be.rsrc
41
42 #specify additional libraries to link against
43 #       if libName.so or libName.a is the name of the library to link against
44 #       then simply specify Name in the LIBS list
45 #       if there is another naming scheme use the full binary
46 #       name: my_library.so or my_lib.a
47 #       libroot.so never needs to be specified here, although libbe.so does
48 LIBS= be tracker
49
50 #       specify the paths to directories where additional
51 #       libraries are to be found.  /boot/develop/lib/PLATFORM/ is
52 #       already set.  The paths can be full or relative to this
53 #       makefile.  The paths included may not be recursive, so
54 #       specify all of the needed paths explicitly
55 #       Directories containing source-files are automatically added.
56 LIBPATHS= 
57
58 #       specify additional directories where header files can be found
59 #       directories where sources are found are included automatically
60 #       included.
61 INCPATHS= 
62
63 #       specify the level of optimization that you desire
64 #       NONE, SOME, FULL
65 OPTIMIZE= NONE
66
67 #       specify any symbols to be defined.  The symbols will be
68 #       set to a value of 1.  For example specify DEBUG if you want
69 #       DEBUG=1 to be set when compiling.
70 DEFINES= 
71
72 #       specify special warning levels
73 #       if unspecified default warnings will be used
74 #       NONE = supress all warnings
75 #       ALL = enable all warnings
76 WARNINGS = 
77
78 #       specify symbols
79 #       if TRUE debug symbols will be created
80 SYMBOLS = TRUE
81
82
83 #       specify debug settings
84 #       if TRUE will allow application to be run from
85 #       the debugger
86 DEBUGGER = TRUE
87
88
89 ## Generic Makefile Rules ---------------------------
90 ##      DO NOT MODIFY BENEATH THIS LINE -----------------
91
92 #       determine wheather running on x86 or ppc
93 MACHINE=$(shell uname -m)
94 ifeq ($(MACHINE), BePC)
95         CPU = x86
96 else
97         CPU = ppc
98 endif
99
100 #       set the directory where object files and binaries will be created
101         OBJ_DIR         := obj.$(CPU)
102
103 #       specify that the binary should be created in the object directory
104         TARGET          := $(NAME)
105
106 #       specify the mimeset tool
107         MIMESET         := mimeset
108
109 # specify the tools for adding and removing resources
110         XRES            = xres
111
112
113 #       platform specific settings
114
115 #       x86 Settings
116 ifeq ($(CPU), x86)
117 #       set the compiler and compiler flags
118         CC              =       gcc
119
120 #       SETTING: set the CFLAGS for each binary type    
121         ifeq ($(TYPE), DRIVER)
122                 CFLAGS  += -no-fpic
123         else
124                 CFLAGS +=
125         endif
126
127 #       SETTING: set the proper optimization level
128         ifeq ($(OPTIMIZE), FULL)
129                 OPTIMIZER       = -O3
130         else
131         ifeq ($(OPTIMIZE), SOME)
132                 OPTIMIZER       = -O1
133         else
134         ifeq ($(OPTIMIZE), NONE)
135                 OPTIMIZER       = -O0
136         else
137 #               OPTIMIZE not set so set to full
138                 OPTIMIZER       = -O3
139         endif
140         endif
141         endif
142
143 #       SETTING: set proper debugger flags
144         ifeq ($(DEBUGGER), TRUE)
145                 DEBUG = -gdwarf-2
146                 OPTIMIZER = -O0
147         endif   
148
149         CFLAGS += $(OPTIMIZER) $(DEBUG)
150
151 #       SETTING: set warning level
152         ifeq ($(WARNINGS), ALL)
153                 CFLAGS += -Wall -Wno-multichar -Wno-ctor-dtor-privacy
154         else
155         ifeq ($(WARNINGS), NONE)
156                 CFLAGS +=
157         endif
158         endif
159
160 #       set the linker and linker flags
161         LD                      = gcc
162         LDFLAGS         += $(DEBUG)
163
164 #       SETTING: set linker flags for each binary type
165         ifeq ($(TYPE), APP)
166                 LDFLAGS += -Xlinker -soname=_APP_
167         else
168         ifeq ($(TYPE), SHARED)
169                 LDFLAGS += -nostart -Xlinker -soname=$(NAME)
170         else
171         ifeq ($(TYPE), DRIVER)
172                 LDFLAGS += -nostdlib /boot/develop/lib/x86/_KERNEL_
173         endif 
174         endif 
175         endif 
176
177 #       SETTING: define debug symbols if desired
178         ifeq ($(SYMBOLS), TRUE)
179                 CFLAGS += -g
180         endif
181
182 else
183
184 #       ppc Settings
185 ifeq ($(CPU), ppc)
186 #       set the compiler and compiler flags
187         CC              =       mwcc
188         CFLAGS  +=      
189
190 #       SETTING: set the proper optimization level
191         ifeq ($(OPTIMIZE), FULL)
192                 OPTIMIZER       = -O7
193         else
194         ifeq ($(OPTIMIZE), SOME)
195                 OPTIMIZER       = -O3
196         else
197         ifeq ($(OPTIMIZE), NONE)
198                 OPTIMIZER       =
199         else
200 #               OPTIMIZE not set so set to full
201                 OPTIMIZER       = -O7
202         endif
203         endif
204         endif
205
206         CFLAGS += $(OPTIMIZER)
207
208 #       SETTING: set warning level
209         ifeq ($(WARNINGS), ALL)
210                 CFLAGS += -w all
211         else
212         ifeq ($(WARNINGS), NONE)
213                 CFLAGS += -w 0
214         endif
215         endif
216
217         # clear the standard environment variable
218         # now there are no standard libraries to link against
219         BELIBFILES=
220
221 #       set the linker and linker flags
222         LD                      = mwldppc
223
224 #       SETTING: set linker flags for each binary type
225         ifeq ($(TYPE), APP)
226                 LDFLAGS += 
227         else
228         ifeq ($(TYPE), SHARED)
229                 LDFLAGS +=      -xms 
230         endif
231         endif
232
233         ifeq ($(TYPE), DRIVER)
234                 LDFLAGS += -nodefaults \
235                                         -export all \
236                                         -G \
237                                         /boot/develop/lib/ppc/glue-noinit.a \
238                                         /boot/develop/lib/ppc/_KERNEL_
239         else
240                 LDFLAGS +=      -export pragma \
241                                         -init _init_routine_ \
242                                         -term _term_routine_ \
243                                         -lroot \
244                                         /boot/develop/lib/ppc/glue-noinit.a \
245                                         /boot/develop/lib/ppc/init_term_dyn.o \
246                                         /boot/develop/lib/ppc/start_dyn.o 
247         endif                   
248
249 #       SETTING: output symbols in an xMAP file
250         ifeq ($(SYMBOLS), TRUE)
251                 LDFLAGS += -map $(TARGET).xMAP
252         endif
253
254 #       SETTING: output debugging info to a .SYM file
255         ifeq ($(DEBUGGER), TRUE)
256                 LDFLAGS += -g -osym $(TARGET).SYM
257         endif
258
259 endif
260 endif
261
262
263 # psuedo-function for converting a list of source files in SOURCES variable
264 # to a corresponding list of object files in $(OBJ_DIR)/xxx.o
265 # The "function" strips off the src file suffix (.ccp or .c or whatever)
266 # and then strips of the directory name, leaving just the root file name.
267 # It then appends the .o suffix and prepends the $(OBJ_DIR)/ path
268 define SRCS_LIST_TO_OBJS
269         $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SOURCES), \
270         $(basename $(notdir $(file))))))
271 endef
272
273 OBJS = $(SRCS_LIST_TO_OBJS)
274
275 # create a unique list of paths to our sourcefiles
276 SRC_PATHS += $(sort $(foreach file, $(SOURCES), $(dir $(file))))
277
278 # add source paths to VPATH if not already present
279 VPATH :=
280 VPATH += $(addprefix :, $(subst  ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS))))
281
282 # add source paths and include paths to INLCUDES if not already present
283 INCLUDES = $(foreach path, $(INCPATHS) $(SRC_PATHS), $(addprefix -I, $(path)))
284
285
286 # SETTING: add the -L prefix to all library paths to search
287 LINK_PATHS = $(foreach path, $(LIBPATHS) $(SRC_PATHS) , \
288         $(addprefix -L, $(path)))
289
290 # SETTING: add the -l prefix to all libs to be linked against
291 LINK_LIBS = $(foreach lib, $(LIBS), $(addprefix -l, $(lib)))
292
293 # add to the linker flags 
294 LDFLAGS += $(LINK_PATHS) $(LINK_LIBS)
295
296 #       SETTING: add the defines to the compiler flags
297 CFLAGS += $(foreach define, $(DEFINES), $(addprefix -D, $(define)))
298
299 #       SETTING: use the archive tools if building a static library
300 #       otherwise use the linker
301 ifeq ($(TYPE), STATIC)
302         BUILD_LINE = ar -cru $(TARGET) $(OBJS)
303 else
304         BUILD_LINE = $(LD) -o $@ $(OBJS) $(LDFLAGS)
305 endif
306
307 #       create the resource instruction
308         ifeq ($(RSRCS), )
309                 DO_RSRCS :=
310         else
311                 DO_RSRCS := $(XRES) -o $(TARGET) $(RSRCS)
312         endif
313
314
315 #       define the actual work to be done       
316 default: $(TARGET)
317
318 $(TARGET):      $(OBJ_DIR) $(OBJS) $(RSRCS)
319                 $(BUILD_LINE)
320                 $(DO_RSRCS)
321                 $(MIMESET) -f $@
322
323
324 #       rule to create the object file directory if needed
325 $(OBJ_DIR)::
326         @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1
327
328 $(OBJ_DIR)/%.o : %.c
329         $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
330 $(OBJ_DIR)/%.o : %.cpp
331         $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
332 $(OBJ_DIR)/%.o : %.cp
333         $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
334 $(OBJ_DIR)/%.o : %.C
335         $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
336 $(OBJ_DIR)/%.o : %.CC
337         $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
338 $(OBJ_DIR)/%.o : %.CPP
339         $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
340
341
342 #       empty rule. Things that depend on this rule will always get triggered
343 FORCE:
344
345 #       The generic clean command. Delete everything in the object folder.
346 clean :: FORCE
347         -rm -rf $(OBJ_DIR)
348
349 #
350 distclean: clean
351
352 #       remove just the application from the object folder
353 rmapp ::
354         -rm -f $(TARGET)
355
356 # generic distdir rules - needed with automake
357 # maybe we can automakify the Makefile?
358
359 srcdir = @srcdir@
360 top_srcdir = @top_srcdir@
361 top_builddir = @top_builddir@
362
363 distdir = $(top_builddir)$(PACKAGE)-$(VERSION)/src/$(subdir)
364
365 subdir = beos
366
367 DISTFILES = $(SOURCES) $(HEADERS) $(EXTRA_DIST)
368
369 distdir: # $(DISTFILES)
370         distdir=`cd $(distdir) && pwd`
371         @for file in $(DISTFILES); do \
372           d=$(srcdir); \
373           if test -d $$d/$$file; then \
374             cp -pr $$d/$$file $(distdir)/$$file; \
375           else \
376             test -f $(distdir)/$$file \
377             || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
378             || cp -p $$d/$$file $(distdir)/$$file || :; \
379           fi; \
380         done