/usr/share/ptlib/make/common.mak is in libpt-dev 2.10.11~dfsg-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | #
# common.mak
#
# Common make rules included in ptlib.mak and pwlib.mak
#
# Portable Windows Library
#
# Copyright (c) 1993-1998 Equivalence Pty. Ltd.
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is Portable Windows Library.
#
# The Initial Developer of the Original Code is Equivalence Pty. Ltd.
#
# Portions are Copyright (C) 1993 Free Software Foundation, Inc.
# All Rights Reserved.
#
# Contributor(s): ______________________________________.
#
# $Revision: 24167 $
# $Author: rjongbloed $
# $Date: 2010-03-30 01:20:06 -0500 (Tue, 30 Mar 2010) $
#
######################################################################
#
# common rules
#
######################################################################
# Submodules built with make lib
LIBDIRS += $(PTLIBDIR)
ifndef OBJDIR
ifndef OBJDIR_PREFIX
OBJDIR_PREFIX=.
endif
OBJDIR = $(OBJDIR_PREFIX)/obj_$(PLATFORM_TYPE)$(OBJDIR_SUFFIX)
endif
vpath %.cxx $(VPATH_CXX)
vpath %.cpp $(VPATH_CXX)
vpath %.c $(VPATH_C)
vpath %.o $(OBJDIR)
vpath %.dep $(DEPDIR)
vpath %.gch $(PTLIBDIR)/include
#
# add common directory to include path - must be after PT directories
#
STDCCFLAGS := -I$(PTLIBDIR)/include $(STDCCFLAGS)
ifneq ($(P_SHAREDLIB),1)
#ifneq ($(OSTYPE),Darwin) # Mac OS X does not really support -static
#LDFLAGS += -static
#endif
ifneq ($(P_STATIC_LDFLAGS),)
LDFLAGS += $(P_STATIC_LDFLAGS)
endif
ifneq ($(P_STATIC_ENDLDLIBS),)
ENDLDLIBS += $(P_STATIC_ENDLDLIBS)
endif
endif
# clean whitespace out of source file list
SOURCES := $(strip $(SOURCES))
ifeq ($(V)$(VERBOSE),)
Q = @
Q_CC = @echo [CC] `echo $< | sed s/$PWD//` ;
Q_DEP= @echo [DEP] `echo $< | sed s/$PWD//` ;
Q_AR = @echo [AR] `echo $@ | sed s/$PWD//` ;
Q_LD = @echo [LD] `echo $@ | sed s/$PWD//` ;
endif
#
# define rule for .cxx, .cpp and .c files
#
$(OBJDIR)/%.o : %.cxx
@if [ ! -d $(OBJDIR) ] ; then mkdir -p $(OBJDIR) ; fi
$(Q_CC)$(CXX) $(STDCCFLAGS) $(STDCXXFLAGS) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o : %.cpp
@if [ ! -d $(OBJDIR) ] ; then mkdir -p $(OBJDIR) ; fi
$(Q_CC)$(CXX) $(STDCCFLAGS) $(STDCXXFLAGS) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o : %.c
@if [ ! -d $(OBJDIR) ] ; then mkdir -p $(OBJDIR) ; fi
$(Q_CC)$(CC) $(STDCCFLAGS) $(CFLAGS) -c $< -o $@
#
# create list of object files
#
SRC_OBJS := $(SOURCES:.c=.o)
SRC_OBJS := $(SRC_OBJS:.cxx=.o)
SRC_OBJS := $(SRC_OBJS:.cpp=.o)
OBJS := $(EXTERNALOBJS) $(patsubst %.o, $(OBJDIR)/%.o, $(notdir $(SRC_OBJS) $(OBJS)))
#
# create list of dependency files
#
DEPDIR := $(OBJDIR)
SRC_DEPS := $(SOURCES:.c=.dep)
SRC_DEPS := $(SRC_DEPS:.cxx=.dep)
SRC_DEPS := $(SRC_DEPS:.cpp=.dep)
DEPS := $(patsubst %.dep, $(DEPDIR)/%.dep, $(notdir $(SRC_DEPS) $(DEPS)))
#
# define rule for .dep files
#
$(DEPDIR)/%.dep : %.cxx
@if [ ! -d $(DEPDIR) ] ; then mkdir -p $(DEPDIR) ; fi
@printf %s $(OBJDIR)/ > $@
$(Q_DEP)$(CXX) $(STDCCFLAGS:-g=) $(CFLAGS) -M $< >> $@
$(DEPDIR)/%.dep : %.cpp
@if [ ! -d $(DEPDIR) ] ; then mkdir -p $(DEPDIR) ; fi
@printf %s $(OBJDIR)/ > $@
$(Q_DEP)$(CXX) $(STDCCFLAGS:-g=) $(CFLAGS) -M $< >> $@
$(DEPDIR)/%.dep : %.c
@if [ ! -d $(DEPDIR) ] ; then mkdir -p $(DEPDIR) ; fi
@printf %s $(OBJDIR)/ > $@
$(Q_DEP)$(CC) $(STDCCFLAGS:-g=) $(CFLAGS) -M $< >> $@
#
# add in good files to delete
#
CLEAN_FILES += $(OBJS) $(DEPS) core
######################################################################
#
# rules for application
#
######################################################################
ifdef PROG
ifndef TARGET
TARGET = $(OBJDIR)/$(PROG)
endif
ifdef BUILDFILES
OBJS += $(OBJDIR)/buildnum.o
endif
TARGET_LIBS = $(PTLIBDIR)/lib_$(PLATFORM_TYPE)/$(PTLIB_FILE)
# distinguish betweek building and using pwlib
ifeq (,$(wildcard $(PTLIBDIR)/src))
TARGET_LIBS = $(SYSLIBDIR)/$(PTLIB_FILE)
endif
$(TARGET): $(OBJS) $(TARGET_LIBS)
ifeq ($(OSTYPE),beos)
# BeOS won't find dynamic libraries unless they are in one of the system
# library directories or in the lib directory under the application's
# directory
@if [ ! -L $(OBJDIR)/lib ] ; then cd $(OBJDIR); ln -s $(PT_LIBDIR) lib; fi
endif
$(Q_LD)$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) $(ENDLDLIBS) $(ENDLDFLAGS)
ifdef DEBUG
ifneq (,$(wildcard $(PTLIBDIR)/src/ptlib/unix))
$(PT_LIBDIR)/$(PTLIB_FILE):
$(MAKE) -C $(PTLIBDIR)/src/ptlib/unix debug
endif
else
ifneq (,$(wildcard $(PTLIBDIR)/src/ptlib/unix))
$(PT_LIBDIR)/$(PTLIB_FILE):
$(MAKE) -C $(PTLIBDIR)/src/ptlib/unix opt
endif
endif
CLEAN_FILES += $(TARGET)
ifndef INSTALL_OVERRIDE
install: $(TARGET)
$(INSTALL) $(TARGET) $(INSTALLBIN_DIR)
endif
# ifdef PROG
endif
######################################################################
#
# Precompiled headers (experimental)
#
USE_PCH:=no
$(PTLIBDIR)/include/ptlib.h.gch/$(PT_OBJBASE): $(PTLIBDIR)/include/ptlib.h
@if [ ! -d `dirname $@` ] ; then mkdir -p `dirname $@` ; fi
$(CXX) $(STDCCFLAGS) $(STDCXXFLAGS) $(CFLAGS) -x c++ -c $< -o $@
ifeq ($(USE_PCH),yes)
PCH_FILES = $(PTLIBDIR)/include/ptlib.h.gch/$(PT_OBJBASE)
CLEAN_FILES += $(PCH_FILES)
precompile: $(PCH_FILES)
@true
else
precompile:
@true
endif
######################################################################
#
# Main targets for build management
#
######################################################################
default_target : precompile $(TARGET)
default_clean :
rm -rf $(CLEAN_FILES)
.DELETE_ON_ERROR : default_depend
default_depend :: $(DEPS)
@echo Created dependencies.
libs ::
set -e; for i in $(LIBDIRS); do $(MAKE) -C $$i default_depend default_target; done
help:
@echo "The following targets are available:"
@echo " make debug Make debug version of application"
@echo " make opt Make optimised version of application"
@echo " make both Make both versions of application"
@echo
@echo " make debugstatic Make static debug version of application"
@echo " make optstatic Make static optimised version of application"
@echo " make bothstatic Make static both versions of application"
@echo
@echo " make debugclean Remove debug files"
@echo " make optclean Remove optimised files"
@echo " make clean Remove both debug and optimised files"
@echo
@echo " make debugdepend Create debug dependency files"
@echo " make optdepend Create optimised dependency files"
@echo " make bothdepend Create both debug and optimised dependency files"
@echo
@echo " make debuglibs Make debug libraries project depends on"
@echo " make optlibs Make optimised libraries project depends on"
@echo " make bothlibs Make both debug and optimised libraries project depends on"
@echo
@echo " make all Create debug & optimised dependencies & libraries"
@echo
@echo " make version Display version for project"
@echo " make tagbuild Do a CVS tag of the source, and bump build number"
@echo " make release Package up optimised version int tar.gz file"
all :: debuglibs debugdepend debug optlibs optdepend opt
clean :: optclean debugclean optnosharedclean debugnosharedclean
depend :: default_depend
both :: opt debug
bothshared :: optshared debugshared
bothstatic :: optstatic debugstatic
bothnoshared :: optnoshared debugnoshared
bothdepend :: optdepend debugdepend
bothlibs :: optlibs debuglibs
opt ::
$(MAKE) DEBUG= default_target
optshared ::
$(MAKE) DEBUG= P_SHAREDLIB=1 default_target
optstatic optnoshared ::
$(MAKE) DEBUG= P_SHAREDLIB=0 default_target
optclean ::
$(MAKE) DEBUG= default_clean
optstaticclean optnosharedclean ::
$(MAKE) DEBUG= P_SHAREDLIB=0 default_clean
optdepend ::
$(MAKE) DEBUG= default_depend
optlibs ::
$(MAKE) DEBUG= libs
debug ::
$(MAKE) DEBUG=1 default_target
debugshared ::
$(MAKE) DEBUG=1 P_SHAREDLIB=1 default_target
debugstatic debugnoshared ::
$(MAKE) DEBUG=1 P_SHAREDLIB=0 default_target
debugclean ::
$(MAKE) DEBUG=1 default_clean
debugstaticclean debugnosharedclean ::
$(MAKE) DEBUG=1 P_SHAREDLIB=0 default_clean
debugdepend ::
$(MAKE) DEBUG=1 default_depend
debuglibs ::
$(MAKE) DEBUG=1 libs
######################################################################
#
# common rule to make a release of the program
#
######################################################################
# if have not explictly defined VERSION_FILE, locate a default
ifndef VERSION_FILE
ifneq (,$(wildcard buildnum.h))
VERSION_FILE := buildnum.h
else
ifneq (,$(wildcard version.h))
VERSION_FILE := version.h
else
ifneq (,$(wildcard custom.cxx))
VERSION_FILE := custom.cxx
endif
endif
endif
endif
ifdef VERSION_FILE
# Set default strings to search in VERSION_FILE
ifndef MAJOR_VERSION_DEFINE
MAJOR_VERSION_DEFINE:=MAJOR_VERSION
endif
ifndef MINOR_VERSION_DEFINE
MINOR_VERSION_DEFINE:=MINOR_VERSION
endif
ifndef BUILD_NUMBER_DEFINE
BUILD_NUMBER_DEFINE:=BUILD_NUMBER
endif
# If not specified, find the various version components in the VERSION_FILE
ifndef MAJOR_VERSION
MAJOR_VERSION:=$(strip $(subst \#define,, $(subst $(MAJOR_VERSION_DEFINE),,\
$(shell grep "define *$(MAJOR_VERSION_DEFINE) *" $(VERSION_FILE)))))
endif
ifndef MINOR_VERSION
MINOR_VERSION:=$(strip $(subst \#define,, $(subst $(MINOR_VERSION_DEFINE),,\
$(shell grep "define *$(MINOR_VERSION_DEFINE)" $(VERSION_FILE)))))
endif
ifndef BUILD_TYPE
BUILD_TYPE:=$(strip $(subst \#define,,$(subst BUILD_TYPE,,\
$(subst AlphaCode,alpha,$(subst BetaCode,beta,$(subst ReleaseCode,.,\
$(shell grep "define *BUILD_TYPE" $(VERSION_FILE))))))))
endif
ifndef BUILD_NUMBER
BUILD_NUMBER:=$(strip $(subst \#define,,$(subst $(BUILD_NUMBER_DEFINE),,\
$(shell grep "define *$(BUILD_NUMBER_DEFINE)" $(VERSION_FILE)))))
endif
# Finally check that version numbers are not empty
ifeq (,$(MAJOR_VERSION))
override MAJOR_VERSION:=1
endif
ifeq (,$(MINOR_VERSION))
override MINOR_VERSION:=0
endif
ifeq (,$(BUILD_TYPE))
override BUILD_TYPE:=alpha
endif
ifeq (,$(BUILD_NUMBER))
override BUILD_NUMBER:=0
endif
# Check for VERSION either predefined or defined by previous section from VERSION_FILE
ifndef VERSION
VERSION:=$(MAJOR_VERSION).$(MINOR_VERSION)$(BUILD_TYPE)$(BUILD_NUMBER)
endif # ifndef VERSION
endif # ifdef VERSION_FILE
# Build the CVS_TAG string from the components
ifndef CVS_TAG
CVS_TAG := v$(MAJOR_VERSION)_$(MINOR_VERSION)$(subst .,_,$(BUILD_TYPE))$(BUILD_NUMBER)
endif
ifdef DEBUG
# Cannot do this in DEBUG mode, so do it without DEBUG
release ::
$(MAKE) DEBUG= release
else
ifndef VERSION
release ::
@echo Must define VERSION macro or have version.h/custom.cxx file.
tagbuild ::
@echo Must define VERSION macro or have version.h/custom.cxx file.
else # ifdef VERSION
# "make release" definition
ifndef RELEASEDIR
RELEASEDIR=releases
endif
ifndef RELEASEBASEDIR
RELEASEBASEDIR=$(PROG)
endif
RELEASEPROGDIR=$(RELEASEDIR)/$(RELEASEBASEDIR)
release :: $(TARGET) releasefiles
cp $(TARGET) $(RELEASEPROGDIR)/$(PROG)
cd $(RELEASEDIR) ; tar chf - $(RELEASEBASEDIR) | gzip > $(PROG)_$(VERSION)_$(PLATFORM_TYPE).tar.gz
rm -r $(RELEASEPROGDIR)
releasefiles ::
-mkdir -p $(RELEASEPROGDIR)
version:
@echo v$(VERSION)
ifndef VERSION_FILE
tagbuild ::
@echo Must define VERSION_FILE macro or have version.h/custom.cxx file.
else # ifndef VERSION_FILE
ifndef CVS_TAG
tagbuild ::
@echo Must define CVS_TAG macro or have version.h/custom.cxx file.
else # ifndef CVS_TAG
tagbuild ::
sed $(foreach dir,$(LIBDIRS), -e "s/ $(notdir $(dir)):.*/ $(notdir $(dir)): $(shell $(MAKE) -s -C $(dir) version)/") $(VERSION_FILE) > $(VERSION_FILE).new
mv -f $(VERSION_FILE).new $(VERSION_FILE)
cvs commit -m "Pre-tagging check in for $(CVS_TAG)." $(VERSION_FILE)
cvs tag -c $(CVS_TAG)
BLD=`expr $(BUILD_NUMBER) + 1` ; \
echo "Incrementing to build number " $$BLD; \
sed "s/$(BUILD_NUMBER_DEFINE)[ ]*[0-9][0-9]*/$(BUILD_NUMBER_DEFINE) $$BLD/" $(VERSION_FILE) > $(VERSION_FILE).new
mv -f $(VERSION_FILE).new $(VERSION_FILE)
cvs commit -m "Incremented build number after tagging to $(CVS_TAG)." $(VERSION_FILE)
cvs -q update -r $(CVS_TAG)
endif # else ifndef CVS_TAG
endif # else ifndef VERSION_FILE
endif # else ifdef VERSION
endif # else ifdef DEBUG
######################################################################
#
# rules for creating build number files
#
######################################################################
ifdef BUILDFILES
$(OBJDIR)/buildnum.o: buildnum.c
cc -o $(OBJDIR)/buildnum.o -c buildnum.c
#ifndef DEBUG
#buildnum.c: $(SOURCES) $(BUILDFILES)
# buildinc buildnum.c
#else
buildnum.c:
#endif
endif
######################################################################
#
# Include all of the dependencies
#
######################################################################
ifndef NODEPS
ifneq ($(wildcard $(DEPDIR)/*.dep),)
include $(DEPDIR)/*.dep
endif
endif
# End of common.mak
|