| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bb00842 commit 48584e7
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,357 @@ | |||
| 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 | + SRCS= GPApp.cpp GPWindow.cpp GPView.cpp GPBitmap.cpp | ||
| 33 | + | ||
| 34 | + # specify the resource files to use | ||
| 35 | + # full path or a relative path to the resource file can be used. | ||
| 36 | + RSRCS= gnuplot_be.rsrc | ||
| 37 | + | ||
| 38 | + #specify additional libraries to link against | ||
| 39 | + # if libName.so or libName.a is the name of the library to link against | ||
| 40 | + # then simply specify Name in the LIBS list | ||
| 41 | + # if there is another naming scheme use the full binary | ||
| 42 | + # name: my_library.so or my_lib.a | ||
| 43 | + # libroot.so never needs to be specified here, although libbe.so does | ||
| 44 | + LIBS= be tracker | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + # specify the paths to directories where additional | ||
| 48 | + # libraries are to be found. /boot/develop/lib/PLATFORM/ is | ||
| 49 | + # already set. The paths can be full or relative to this | ||
| 50 | + # makefile. The paths included may not be recursive, so | ||
| 51 | + # specify all of the needed paths explicitly | ||
| 52 | + # Directories containing source-files are automatically added. | ||
| 53 | + LIBPATHS= | ||
| 54 | + | ||
| 55 | + # specify additional directories where header files can be found | ||
| 56 | + # directories where sources are found are included automatically | ||
| 57 | + # included. | ||
| 58 | + INCPATHS= | ||
| 59 | + | ||
| 60 | + # specify the level of optimization that you desire | ||
| 61 | + # NONE, SOME, FULL | ||
| 62 | + OPTIMIZE= NONE | ||
| 63 | + | ||
| 64 | + # specify any symbols to be defined. The symbols will be | ||
| 65 | + # set to a value of 1. For example specify DEBUG if you want | ||
| 66 | + # DEBUG=1 to be set when compiling. | ||
| 67 | + DEFINES= | ||
| 68 | + | ||
| 69 | + # specify special warning levels | ||
| 70 | + # if unspecified default warnings will be used | ||
| 71 | + # NONE = supress all warnings | ||
| 72 | + # ALL = enable all warnings | ||
| 73 | + WARNINGS = | ||
| 74 | + | ||
| 75 | + # specify symbols | ||
| 76 | + # if TRUE debug symbols will be created | ||
| 77 | + SYMBOLS = TRUE | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + # specify debug settings | ||
| 81 | + # if TRUE will allow application to be run from | ||
| 82 | + # the debugger | ||
| 83 | + DEBUGGER = TRUE | ||
| 84 | + | ||
| 85 | + | ||
| 86 | + ## Generic Makefile Rules --------------------------- | ||
| 87 | + ## DO NOT MODIFY BENEATH THIS LINE ----------------- | ||
| 88 | + | ||
| 89 | + # determine wheather running on x86 or ppc | ||
| 90 | + MACHINE=$(shell uname -m) | ||
| 91 | + ifeq ($(MACHINE), BePC) | ||
| 92 | + CPU = x86 | ||
| 93 | + else | ||
| 94 | + CPU = ppc | ||
| 95 | + endif | ||
| 96 | + | ||
| 97 | + # set the directory where object files and binaries will be created | ||
| 98 | + OBJ_DIR := obj.$(CPU) | ||
| 99 | + | ||
| 100 | + # specify that the binary should be created in the object directory | ||
| 101 | + TARGET := $(NAME) | ||
| 102 | + | ||
| 103 | + # specify the mimeset tool | ||
| 104 | + MIMESET := mimeset | ||
| 105 | + | ||
| 106 | + # specify the tools for adding and removing resources | ||
| 107 | + XRES = xres | ||
| 108 | + | ||
| 109 | + | ||
| 110 | + # platform specific settings | ||
| 111 | + | ||
| 112 | + # x86 Settings | ||
| 113 | + ifeq ($(CPU), x86) | ||
| 114 | + # set the compiler and compiler flags | ||
| 115 | + CC = gcc | ||
| 116 | + | ||
| 117 | + # SETTING: set the CFLAGS for each binary type | ||
| 118 | + ifeq ($(TYPE), DRIVER) | ||
| 119 | + CFLAGS += -no-fpic | ||
| 120 | + else | ||
| 121 | + CFLAGS += | ||
| 122 | + endif | ||
| 123 | + | ||
| 124 | + # SETTING: set the proper optimization level | ||
| 125 | + ifeq ($(OPTIMIZE), FULL) | ||
| 126 | + OPTIMIZER = -O3 | ||
| 127 | + else | ||
| 128 | + ifeq ($(OPTIMIZE), SOME) | ||
| 129 | + OPTIMIZER = -O1 | ||
| 130 | + else | ||
| 131 | + ifeq ($(OPTIMIZE), NONE) | ||
| 132 | + OPTIMIZER = -O0 | ||
| 133 | + else | ||
| 134 | + # OPTIMIZE not set so set to full | ||
| 135 | + OPTIMIZER = -O3 | ||
| 136 | + endif | ||
| 137 | + endif | ||
| 138 | + endif | ||
| 139 | + | ||
| 140 | + | ||
| 141 | + | ||
| 142 | + # SETTING: set proper debugger flags | ||
| 143 | + ifeq ($(DEBUGGER), TRUE) | ||
| 144 | + DEBUG = -gdwarf-2 | ||
| 145 | + OPTIMIZER = -O0 | ||
| 146 | + endif | ||
| 147 | + | ||
| 148 | + CFLAGS += $(OPTIMIZER) $(DEBUG) | ||
| 149 | + | ||
| 150 | + # SETTING: set warning level | ||
| 151 | + ifeq ($(WARNINGS), ALL) | ||
| 152 | + CFLAGS += -Wall -Wno-multichar -Wno-ctor-dtor-privacy | ||
| 153 | + else | ||
| 154 | + ifeq ($(WARNINGS), NONE) | ||
| 155 | + CFLAGS += | ||
| 156 | + endif | ||
| 157 | + endif | ||
| 158 | + | ||
| 159 | + # set the linker and linker flags | ||
| 160 | + LD = gcc | ||
| 161 | + LDFLAGS += $(DEBUG) | ||
| 162 | + | ||
| 163 | + # SETTING: set linker flags for each binary type | ||
| 164 | + ifeq ($(TYPE), APP) | ||
| 165 | + LDFLAGS += -Xlinker -soname=_APP_ | ||
| 166 | + else | ||
| 167 | + ifeq ($(TYPE), SHARED) | ||
| 168 | + LDFLAGS += -nostart -Xlinker -soname=$(NAME) | ||
| 169 | + else | ||
| 170 | + ifeq ($(TYPE), DRIVER) | ||
| 171 | + LDFLAGS += -nostdlib /boot/develop/lib/x86/_KERNEL_ | ||
| 172 | + endif | ||
| 173 | + endif | ||
| 174 | + endif | ||
| 175 | + | ||
| 176 | + # SETTING: define debug symbols if desired | ||
| 177 | + ifeq ($(SYMBOLS), TRUE) | ||
| 178 | + CFLAGS += -g | ||
| 179 | + endif | ||
| 180 | + | ||
| 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 | + | ||
| 207 | + CFLAGS += $(OPTIMIZER) | ||
| 208 | + | ||
| 209 | + # SETTING: set warning level | ||
| 210 | + ifeq ($(WARNINGS), ALL) | ||
| 211 | + CFLAGS += -w all | ||
| 212 | + else | ||
| 213 | + ifeq ($(WARNINGS), NONE) | ||
| 214 | + CFLAGS += -w 0 | ||
| 215 | + endif | ||
| 216 | + endif | ||
| 217 | + | ||
| 218 | + # clear the standard environment variable | ||
| 219 | + # now there are no standard libraries to link against | ||
| 220 | + BELIBFILES= | ||
| 221 | + | ||
| 222 | + # set the linker and linker flags | ||
| 223 | + LD = mwldppc | ||
| 224 | + | ||
| 225 | + # SETTING: set linker flags for each binary type | ||
| 226 | + ifeq ($(TYPE), APP) | ||
| 227 | + LDFLAGS += | ||
| 228 | + else | ||
| 229 | + ifeq ($(TYPE), SHARED) | ||
| 230 | + LDFLAGS += -xms | ||
| 231 | + endif | ||
| 232 | + endif | ||
| 233 | + | ||
| 234 | + ifeq ($(TYPE), DRIVER) | ||
| 235 | + LDFLAGS += -nodefaults \ | ||
| 236 | + -export all \ | ||
| 237 | + -G \ | ||
| 238 | + /boot/develop/lib/ppc/glue-noinit.a \ | ||
| 239 | + /boot/develop/lib/ppc/_KERNEL_ | ||
| 240 | + else | ||
| 241 | + LDFLAGS += -export pragma \ | ||
| 242 | + -init _init_routine_ \ | ||
| 243 | + -term _term_routine_ \ | ||
| 244 | + -lroot \ | ||
| 245 | + /boot/develop/lib/ppc/glue-noinit.a \ | ||
| 246 | + /boot/develop/lib/ppc/init_term_dyn.o \ | ||
| 247 | + /boot/develop/lib/ppc/start_dyn.o | ||
| 248 | + endif | ||
| 249 | + | ||
| 250 | + | ||
| 251 | + # SETTING: output symbols in an xMAP file | ||
| 252 | + ifeq ($(SYMBOLS), TRUE) | ||
| 253 | + LDFLAGS += -map $(TARGET).xMAP | ||
| 254 | + endif | ||
| 255 | + | ||
| 256 | + # SETTING: output debugging info to a .SYM file | ||
| 257 | + ifeq ($(DEBUGGER), TRUE) | ||
| 258 | + LDFLAGS += -g -osym $(TARGET).SYM | ||
| 259 | + endif | ||
| 260 | + | ||
| 261 | + endif | ||
| 262 | + endif | ||
| 263 | + | ||
| 264 | + | ||
| 265 | + # psuedo-function for converting a list of source files in SRCS variable | ||
| 266 | + # to a corresponding list of object files in $(OBJ_DIR)/xxx.o | ||
| 267 | + # The "function" strips off the src file suffix (.ccp or .c or whatever) | ||
| 268 | + # and then strips of the directory name, leaving just the root file name. | ||
| 269 | + # It then appends the .o suffix and prepends the $(OBJ_DIR)/ path | ||
| 270 | + define SRCS_LIST_TO_OBJS | ||
| 271 | + $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SRCS), \ | ||
| 272 | + $(basename $(notdir $(file)))))) | ||
| 273 | + endef | ||
| 274 | + | ||
| 275 | + OBJS = $(SRCS_LIST_TO_OBJS) | ||
| 276 | + | ||
| 277 | + # create a unique list of paths to our sourcefiles | ||
| 278 | + SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) | ||
| 279 | + | ||
| 280 | + # add source paths to VPATH if not already present | ||
| 281 | + VPATH := | ||
| 282 | + VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) | ||
| 283 | + | ||
| 284 | + # add source paths and include paths to INLCUDES if not already present | ||
| 285 | + INCLUDES = $(foreach path, $(INCPATHS) $(SRC_PATHS), $(addprefix -I, $(path))) | ||
| 286 | + | ||
| 287 | + | ||
| 288 | + # SETTING: add the -L prefix to all library paths to search | ||
| 289 | + LINK_PATHS = $(foreach path, $(LIBPATHS) $(SRC_PATHS) , \ | ||
| 290 | + $(addprefix -L, $(path))) | ||
| 291 | + | ||
| 292 | + # SETTING: add the -l prefix to all libs to be linked against | ||
| 293 | + LINK_LIBS = $(foreach lib, $(LIBS), $(addprefix -l, $(lib))) | ||
| 294 | + | ||
| 295 | + # add to the linker flags | ||
| 296 | + LDFLAGS += $(LINK_PATHS) $(LINK_LIBS) | ||
| 297 | + | ||
| 298 | + # SETTING: add the defines to the compiler flags | ||
| 299 | + CFLAGS += $(foreach define, $(DEFINES), $(addprefix -D, $(define))) | ||
| 300 | + | ||
| 301 | + # SETTING: use the archive tools if building a static library | ||
| 302 | + # otherwise use the linker | ||
| 303 | + ifeq ($(TYPE), STATIC) | ||
| 304 | + BUILD_LINE = ar -cru $(TARGET) $(OBJS) | ||
| 305 | + else | ||
| 306 | + BUILD_LINE = $(LD) -o $@ $(OBJS) $(LDFLAGS) | ||
| 307 | + endif | ||
| 308 | + | ||
| 309 | + # create the resource instruction | ||
| 310 | + ifeq ($(RSRCS), ) | ||
| 311 | + DO_RSRCS := | ||
| 312 | + else | ||
| 313 | + DO_RSRCS := $(XRES) -o $(TARGET) $(RSRCS) | ||
| 314 | + endif | ||
| 315 | + | ||
| 316 | + | ||
| 317 | + # define the actual work to be done | ||
| 318 | + default: $(TARGET) | ||
| 319 | + | ||
| 320 | + $(TARGET): $(OBJ_DIR) $(OBJS) $(RSRCS) | ||
| 321 | + $(BUILD_LINE) | ||
| 322 | + $(DO_RSRCS) | ||
| 323 | + $(MIMESET) -f $@ | ||
| 324 | + | ||
| 325 | + | ||
| 326 | + # rule to create the object file directory if needed | ||
| 327 | + $(OBJ_DIR):: | ||
| 328 | + @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 | ||
| 329 | + | ||
| 330 | + $(OBJ_DIR)/%.o : %.c | ||
| 331 | + $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@ | ||
| 332 | + $(OBJ_DIR)/%.o : %.cpp | ||
| 333 | + $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@ | ||
| 334 | + $(OBJ_DIR)/%.o : %.cp | ||
| 335 | + $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@ | ||
| 336 | + $(OBJ_DIR)/%.o : %.C | ||
| 337 | + $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@ | ||
| 338 | + $(OBJ_DIR)/%.o : %.CC | ||
| 339 | + $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@ | ||
| 340 | + $(OBJ_DIR)/%.o : %.CPP | ||
| 341 | + $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@ | ||
| 342 | + | ||
| 343 | + | ||
| 344 | + # empty rule. Things that depend on this rule will always get triggered | ||
| 345 | + FORCE: | ||
| 346 | + | ||
| 347 | + # The generic clean command. Delete everything in the object folder. | ||
| 348 | + clean :: FORCE | ||
| 349 | + -rm -rf $(OBJ_DIR) | ||
| 350 | + | ||
| 351 | + # | ||
| 352 | + distclean: clean | ||
| 353 | + -rm -f Makefile | ||
| 354 | + | ||
| 355 | + # remove just the application from the object folder | ||
| 356 | + rmapp :: | ||
| 357 | + -rm -f $(TARGET) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments