1 ## BeOS Generic Makefile v2.0b3 ##
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.
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.
12 ## Application Specific Settings ---------------------------------------------
14 # specify the name of the binary
17 # specify the type of binary
19 # SHARED: Shared library or add-on
20 # STATIC: Static library archive
21 # DRIVER: Kernel Driver
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
34 HEADERS= GPApp.h GPBitmap.h GPView.h GPWindow.h XStringList.h constants.h
36 EXTRA_DIST= XStringList.cpp
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
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
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.
58 # specify additional directories where header files can be found
59 # directories where sources are found are included automatically
63 # specify the level of optimization that you desire
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.
72 # specify special warning levels
73 # if unspecified default warnings will be used
74 # NONE = supress all warnings
75 # ALL = enable all warnings
79 # if TRUE debug symbols will be created
83 # specify debug settings
84 # if TRUE will allow application to be run from
89 ## Generic Makefile Rules ---------------------------
90 ## DO NOT MODIFY BENEATH THIS LINE -----------------
92 # determine wheather running on x86 or ppc
93 MACHINE=$(shell uname -m)
94 ifeq ($(MACHINE), BePC)
100 # set the directory where object files and binaries will be created
101 OBJ_DIR := obj.$(CPU)
103 # specify that the binary should be created in the object directory
106 # specify the mimeset tool
109 # specify the tools for adding and removing resources
113 # platform specific settings
117 # set the compiler and compiler flags
120 # SETTING: set the CFLAGS for each binary type
121 ifeq ($(TYPE), DRIVER)
127 # SETTING: set the proper optimization level
128 ifeq ($(OPTIMIZE), FULL)
131 ifeq ($(OPTIMIZE), SOME)
134 ifeq ($(OPTIMIZE), NONE)
137 # OPTIMIZE not set so set to full
143 # SETTING: set proper debugger flags
144 ifeq ($(DEBUGGER), TRUE)
149 CFLAGS += $(OPTIMIZER) $(DEBUG)
151 # SETTING: set warning level
152 ifeq ($(WARNINGS), ALL)
153 CFLAGS += -Wall -Wno-multichar -Wno-ctor-dtor-privacy
155 ifeq ($(WARNINGS), NONE)
160 # set the linker and linker flags
164 # SETTING: set linker flags for each binary type
166 LDFLAGS += -Xlinker -soname=_APP_
168 ifeq ($(TYPE), SHARED)
169 LDFLAGS += -nostart -Xlinker -soname=$(NAME)
171 ifeq ($(TYPE), DRIVER)
172 LDFLAGS += -nostdlib /boot/develop/lib/x86/_KERNEL_
177 # SETTING: define debug symbols if desired
178 ifeq ($(SYMBOLS), TRUE)
186 # set the compiler and compiler flags
190 # SETTING: set the proper optimization level
191 ifeq ($(OPTIMIZE), FULL)
194 ifeq ($(OPTIMIZE), SOME)
197 ifeq ($(OPTIMIZE), NONE)
200 # OPTIMIZE not set so set to full
206 CFLAGS += $(OPTIMIZER)
208 # SETTING: set warning level
209 ifeq ($(WARNINGS), ALL)
212 ifeq ($(WARNINGS), NONE)
217 # clear the standard environment variable
218 # now there are no standard libraries to link against
221 # set the linker and linker flags
224 # SETTING: set linker flags for each binary type
228 ifeq ($(TYPE), SHARED)
233 ifeq ($(TYPE), DRIVER)
234 LDFLAGS += -nodefaults \
237 /boot/develop/lib/ppc/glue-noinit.a \
238 /boot/develop/lib/ppc/_KERNEL_
240 LDFLAGS += -export pragma \
241 -init _init_routine_ \
242 -term _term_routine_ \
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
249 # SETTING: output symbols in an xMAP file
250 ifeq ($(SYMBOLS), TRUE)
251 LDFLAGS += -map $(TARGET).xMAP
254 # SETTING: output debugging info to a .SYM file
255 ifeq ($(DEBUGGER), TRUE)
256 LDFLAGS += -g -osym $(TARGET).SYM
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))))))
273 OBJS = $(SRCS_LIST_TO_OBJS)
275 # create a unique list of paths to our sourcefiles
276 SRC_PATHS += $(sort $(foreach file, $(SOURCES), $(dir $(file))))
278 # add source paths to VPATH if not already present
280 VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS))))
282 # add source paths and include paths to INLCUDES if not already present
283 INCLUDES = $(foreach path, $(INCPATHS) $(SRC_PATHS), $(addprefix -I, $(path)))
286 # SETTING: add the -L prefix to all library paths to search
287 LINK_PATHS = $(foreach path, $(LIBPATHS) $(SRC_PATHS) , \
288 $(addprefix -L, $(path)))
290 # SETTING: add the -l prefix to all libs to be linked against
291 LINK_LIBS = $(foreach lib, $(LIBS), $(addprefix -l, $(lib)))
293 # add to the linker flags
294 LDFLAGS += $(LINK_PATHS) $(LINK_LIBS)
296 # SETTING: add the defines to the compiler flags
297 CFLAGS += $(foreach define, $(DEFINES), $(addprefix -D, $(define)))
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)
304 BUILD_LINE = $(LD) -o $@ $(OBJS) $(LDFLAGS)
307 # create the resource instruction
311 DO_RSRCS := $(XRES) -o $(TARGET) $(RSRCS)
315 # define the actual work to be done
318 $(TARGET): $(OBJ_DIR) $(OBJS) $(RSRCS)
324 # rule to create the object file directory if needed
326 @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1
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 $@
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 $@
342 # empty rule. Things that depend on this rule will always get triggered
345 # The generic clean command. Delete everything in the object folder.
352 # remove just the application from the object folder
356 # generic distdir rules - needed with automake
357 # maybe we can automakify the Makefile?
360 top_srcdir = @top_srcdir@
361 top_builddir = @top_builddir@
363 distdir = $(top_builddir)$(PACKAGE)-$(VERSION)/src/$(subdir)
367 DISTFILES = $(SOURCES) $(HEADERS) $(EXTRA_DIST)
369 distdir: # $(DISTFILES)
370 distdir=`cd $(distdir) && pwd`
371 @for file in $(DISTFILES); do \
373 if test -d $$d/$$file; then \
374 cp -pr $$d/$$file $(distdir)/$$file; \
376 test -f $(distdir)/$$file \
377 || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
378 || cp -p $$d/$$file $(distdir)/$$file || :; \