4 # First part of make rules, included in ptlib.mak and pwlib.mak.
5 # Note: Do not put any targets in the file. This should defaine variables
6 # only, as targets are all in common.mak
8 # Portable Windows Library
10 # Copyright (c) 1993-1998 Equivalence Pty. Ltd.
12 # The contents of this file are subject to the Mozilla Public License
13 # Version 1.0 (the "License"); you may not use this file except in
14 # compliance with the License. You may obtain a copy of the License at
15 # http://www.mozilla.org/MPL/
17 # Software distributed under the License is distributed on an "AS IS"
18 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19 # the License for the specific language governing rights and limitations
22 # The Original Code is Portable Windows Library.
24 # The Initial Developer of the Original Code is Equivalence Pty. Ltd.
26 # Portions are Copyright (C) 1993 Free Software Foundation, Inc.
27 # All Rights Reserved.
29 # Contributor(s): ______________________________________.
32 # Revision 1.190 2004/06/18 00:38:08 csoutheren
33 # Added check for FD_SETSIZE as suggested by Joegen E. Baclor
35 # Revision 1.189 2004/06/10 01:36:44 csoutheren
36 # Fixed problems with static links
38 # Revision 1.188 2004/05/30 04:49:42 ykiryanov
39 # Streamlined BeOS section
41 # Revision 1.187 2004/04/25 22:11:34 ykiryanov
42 # Added posix library to make files
44 # Revision 1.186 2004/04/21 03:47:36 ykiryanov
45 # Added libdl.so to library list for BeOS
47 # Revision 1.185 2004/04/12 03:35:27 csoutheren
48 # Fixed problems with non-recursuve mutexes and critical sections on
49 # older compilers and libc
51 # Revision 1.184 2004/02/26 11:19:07 csoutheren
52 # Added changes for BeOS, thanks to Yuri Kiryanov
53 # Added changes to fix link problems on some platforms, thanks to Klaus Kaempf
55 # Revision 1.183 2004/02/21 19:44:54 ykiryanov
56 # Fixed make parameters for BeOS: Changed default on BeOS to using Be BONE
58 # Revision 1.182 2004/02/11 05:09:14 csoutheren
59 # Fixed problems with regex libraries on Solaris, and with host OS numbering
60 # being a quoted string rather than a number. Thanks to Chad Attermann
61 # Fixed problems SSL detection problems thanks to Michal Zygmuntowicz
63 # Revision 1.181 2004/02/09 06:24:37 csoutheren
64 # Allowed CXX environment variable to define C++ compiler to use
65 # as required by configure
67 # Revision 1.180 2004/01/29 13:43:59 csoutheren
68 # Moved some preprocessor symbols from the command line to include files
69 # Modified to set P_HAS_SEMAPHORES to 0 for Linux kernels >= 2.6
70 # Applied patches for Solaris thanks to Michal Zygmuntowicz
72 # Revision 1.179 2003/11/02 16:00:26 shawn
73 # Panther requires -lresolv
75 # Revision 1.178 2003/09/18 23:02:35 csoutheren
76 # Removed definition of PMEMORY_CHECK
78 # Revision 1.177 2003/09/17 01:18:03 csoutheren
79 # Removed recursive include file system and removed all references
80 # to deprecated coooperative threading support
82 # Revision 1.176 2003/09/08 21:11:09 dereksmithies
83 # Remove hardcoded path from make file. Thanks Damien Sandras.
85 # Revision 1.175 2003/07/24 22:01:42 dereksmithies
86 # Add fixes from Peter Nixon for fixing install problems. Thanks.
88 # Revision 1.174 2003/06/18 13:19:01 csoutheren
89 # Default debug builds now shared
91 # Revision 1.173 2003/06/17 12:05:01 csoutheren
92 # Changed compiler flags for optimised build
94 # Revision 1.172 2003/05/22 12:17:06 dsandras
96 # Removed unneeded code since Firewire support has been moved to configure.
98 # Revision 1.171 2003/05/06 09:47:20 robertj
99 # Fixed up MacOSX changes so is compatible with previous "API" not requiring
100 # downstream libraries to change
102 # Revision 1.170 2003/05/06 06:59:12 robertj
103 # Dynamic library support for MacOSX, thanks Hugo Santos
105 # Revision 1.169 2003/05/05 13:10:59 robertj
106 # Solaris compatibility
108 # Revision 1.168 2003/04/17 07:29:27 robertj
109 # Fixed solaris link problem
111 # Revision 1.167 2003/04/17 00:05:04 craigs
112 # Added patches from Hugo Santos mainly for Darwin compatibility
114 # Revision 1.166 2003/04/16 07:16:55 craigs
115 # Modified for new autoconf based configuration
118 # Log truncated by CRS 14 April 2003
122 PWLIBDIR
= $(HOME
)/pwlib
125 ####################################################
127 # include generated build options file, then include it
128 include $(PWLIBDIR
)/make
/ptbuildopts.mak
130 ###############################################################################
132 # this section used to normalise the machine name and OS type
133 # this is now done by autoconf - but this left here as a reference
137 ifdef USE_OLD_MACHINE_CHECKING
140 OSTYPE
:= $(shell uname
-s
)
144 MACHTYPE
:= $(shell uname
-m
)
147 ifneq (,$(findstring linux
,$(HOSTTYPE
)))
148 ifneq (,$(findstring $(HOSTTYPE
),i386-linux i486-linux
))
154 ifeq ($(OSTYPE
),mklinux
)
159 ifneq (,$(findstring $(OSTYPE
),Linux linux-gnu
))
163 ifneq (,$(findstring $(OSTYPE
),Solaris SunOS
))
167 ifneq (,$(findstring $(OSTYPE
),IRIX
))
171 #Convert bash shell OSTYPE of 'freebsd3.4' to 'FreeBSD'
172 ifneq (,$(findstring freebsd
,$(OSTYPE
)))
176 #Convert bash shell OSTYPE of 'openbsd2.6' to 'OpenBSD'
177 ifneq (,$(findstring openbsd
,$(OSTYPE
)))
181 ifneq (,$(findstring macos
,$(OSTYPE
)))
185 ifneq (,$(findstring darwin
,$(OSTYPE
)))
189 ifneq (,$(findstring AIX
,$(OSTYPE
)))
193 ifneq (,$(findstring $(OS
),VXWORKS
))
197 ifneq (,$(findstring netbsd
,$(OSTYPE
)))
201 ifneq (,$(findstring sparc
, $(MACHTYPE
)))
205 ifneq (,$(findstring sun4
, $(MACHTYPE
)))
209 ifneq (,$(findstring i86
, $(MACHTYPE
)))
213 ifneq (,$(findstring i386
, $(MACHTYPE
)))
217 ifneq (,$(findstring i486
, $(MACHTYPE
)))
219 POSSIBLE_CPUTYPE
:= i486
222 ifneq (,$(findstring i586
, $(MACHTYPE
)))
224 POSSIBLE_CPUTYPE
:= i586
227 ifneq (,$(findstring i686
, $(MACHTYPE
)))
229 POSSIBLE_CPUTYPE
:= i686
232 #make sure x86 does not match x86_64 by mistake
233 ifneq (,$(findstring x86
, $(MACHTYPE
)))
234 ifneq (,$(findstring x86_64
, $(MACHTYPE
)))
241 ifneq (,$(findstring powerpc
, $(MACHTYPE
)))
245 ifneq (,$(findstring ppc
, $(MACHTYPE
)))
246 ifneq (,$(findstring ppc64
, $(MACHTYPE
)))
253 ifneq (,$(findstring Power
, $(MACHTYPE
)))
257 ifneq (,$(findstring mips
, $(MACHTYPE
)))
261 ifneq (,$(findstring alpha
, $(MACHTYPE
)))
265 ifneq (,$(findstring sparc
, $(MACHTYPE
)))
269 ifneq (,$(findstring ia64
, $(MACHTYPE
)))
273 ifneq (,$(findstring s390
, $(MACHTYPE
)))
274 ifneq (,$(findstring s390x
, $(MACHTYPE
)))
281 ifneq (,$(findstring armv4l
, $(MACHTYPE
)))
285 CPUTYPE
:= $(POSSIBLE_CPUTYPE
)
290 endif # USE_OLD_MACHINE_CHECKING
294 optdepend debugdepend bothdepend \
295 optshared debugshared bothshared \
296 optnoshared debugnoshared bothnoshared \
297 optclean debugclean
clean \
300 .PHONY
: all $(STANDARD_TARGETS
)
303 ifeq (,$(findstring $(OSTYPE
),linux FreeBSD OpenBSD NetBSD solaris beos Darwin Carbon AIX Nucleus VxWorks rtems QNX
))
307 @echo
######################################################################
308 @echo
"Warning: OSTYPE=$(OSTYPE) support has not been confirmed. This may"
309 @echo
" be a new operating system not yet encountered, or more"
310 @echo
" likely, the OSTYPE and MACHTYPE environment variables are"
311 @echo
" set to unusual values. You may need to explicitly set these"
312 @echo
" variables for the correct operation of this system."
314 @echo
" Currently supported OSTYPE names are:"
315 @echo
" linux Linux linux-gnu mklinux"
316 @echo
" solaris Solaris SunOS"
317 @echo
" FreeBSD OpenBSD NetBSD beos Darwin Carbon"
318 @echo
" VxWorks rtems"
320 @echo
" **********************************"
321 @echo
" *** DO NOT IGNORE THIS MESSAGE ***"
322 @echo
" **********************************"
324 @echo
" The system almost certainly will not compile! When you get"
325 @echo
" it working please send patches to support@equival.com.au"
326 @echo
######################################################################
329 $(STANDARD_TARGETS
) :: default_target
333 default_target
: help
337 ####################################################
339 # Set default for shared library usage
347 # -Wall must be at the start of the options otherwise
348 # any -W overrides won't have any effect
352 STDCCFLAGS
+= $(RPM_OPT_FLAGS
)
355 ifneq ($(OSTYPE
),rtems
)
357 SYSINCDIR
:= /usr
/include
361 ####################################################
363 ifeq ($(OSTYPE
),linux
)
365 ifeq ($(MACHTYPE
),x86
)
367 ifeq ($(CPUTYPE
),crusoe
)
368 STDCCFLAGS
+= -fomit-frame-pointer
-fno-strict-aliasing
-fno-common
-pipe
-mpreferred-stack-boundary
=2 -march
=i686
-malign-functions
=0
369 STDCCFLAGS
+= -malign-jumps
=0 -malign-loops
=0
371 STDCCFLAGS
+= -mcpu
=$(CPUTYPE
)
376 ifeq ($(MACHTYPE
),ia64
)
377 STDCCFLAGS
+= -DP_64BIT
380 ifeq ($(MACHTYPE
),s390x
)
381 STDCCFLAGS
+= -DP_64BIT
384 ifeq ($(MACHTYPE
),x86_64
)
385 STDCCFLAGS
+= -DP_64BIT
389 ifeq ($(MACHTYPE
),ppc64
)
390 STDCCFLAGS
+= -DP_64BIT
393 ifeq ($(P_SHAREDLIB
),1)
400 STATIC_LIBS
:= libstdc
++.a libg
++.a libm.a libc.a
401 SYSLIBDIR
:= $(shell $(PWLIBDIR
)/make
/ptlib-config
--libdir)
406 ####################################################
408 ifeq ($(OSTYPE
),FreeBSD
)
410 ifeq ($(MACHTYPE
),x86
)
412 STDCCFLAGS
+= -mcpu
=$(CPUTYPE
)
417 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
423 ####################################################
425 ifeq ($(OSTYPE
),OpenBSD
)
427 ifeq ($(MACHTYPE
),x86
)
434 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
440 ####################################################
442 ifeq ($(OSTYPE
),NetBSD
)
444 ifeq ($(MACHTYPE
),x86
)
450 STDCCFLAGS
+= -I
$(UNIX_INC_DIR
) -I
$(PWLIBDIR
)/include
452 # enable the USE_PTH line to compile using pth
453 # enable the USE_NATIVE_THREADS line to compile using native threads
454 # enable the USE_UNPROVEN_THREADS line to compile using unproven threads
455 #USE_PTH_THREADS := 1
456 #USE_UNPROVEN_THREADS := 1
457 USE_NATIVE_THREADS
:= 1
460 ifdef USE_NATIVE_THREADS
463 ifdef USE_PTH_THREADS
464 STDCCFLAGS
+= -DP_GNU_PTH
465 STDCCFLAGS
+= -I
/usr
/pkg
/include
466 LDFLAGS
+= -L
/usr
/pkg
/lib
469 STDCCFLAGS
+= -DP_NO_CANCEL
470 STDCCFLAGS
+= -I
/usr
/pkg
/pthreads
/include
471 LDFLAGS
+= -L
/usr
/pkg
/pthreads
/lib
473 CC
:= /usr
/pkg
/pthreads
/bin
/pgcc
474 CPLUS
:= /usr
/pkg
/pthreads
/bin
/pg
++
480 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
486 ####################################################
490 STDCCFLAGS
+= -DP_AIX
492 # LDLIBS += -lossaudio
494 STDCCFLAGS
+= -mminimal-toc
497 STDCCFLAGS
+= -DP_USE_PRAGMA
503 ####################################################
505 ifeq ($(OSTYPE
),sunos
)
507 # Sparc Sun 4x, using gcc 2.7.2
510 REQUIRES_SEPARATE_SWITCH
= 1
511 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
516 ####################################################
518 ifeq ($(OSTYPE
),solaris
)
520 # Solaris (Sunos 5.x)
522 ifeq ($(MACHTYPE
),x86
)
523 DEBUG_FLAG
:= -gstabs
+
526 ENDLDLIBS
+= -lsocket
-lnsl
-ldl
-lposix4
528 # Sparc Solaris 2.x, using gcc 2.x
533 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
535 STATIC_LIBS
:= libstdc
++.a libg
++.a
536 SYSLIBDIR
:= /opt
/openh323
/lib
538 # Rest added by jpd@louisiana.edu, to get .so libs created!
550 ####################################################
552 ifeq ($(OSTYPE
),irix
)
554 # should work whith Irix 6.5
558 STDCCFLAGS
+= -DP_IRIX
559 LDLIBS
+= -lsocket
-lnsl
561 STDCCFLAGS
+= -DP_USE_PRAGMA
566 ####################################################
568 ifeq ($(OSTYPE
),beos
)
570 SYSLIBS
+= -lbe
-lmedia
-lgame
-lroot
-lsocket
-lbind
-ldl
571 STDCCFLAGS
+= -DBE_THREADS
-DP_USE_PRAGMA
-Wno-multichar
-Wno-format
578 ####################################################
580 ifeq ($(OSTYPE
),ultrix
)
582 # R2000 Ultrix 4.2, using gcc 2.7.x
583 STDCCFLAGS
+= -DP_ULTRIX
584 STDCCFLAGS
+= -DP_USE_PRAGMA
588 ####################################################
590 ifeq ($(OSTYPE
),hpux
)
591 STDCCFLAGS
+= -DP_USE_PRAGMA
592 # HP/UX 9.x, using gcc 2.6.C3 (Cygnus version)
593 STDCCFLAGS
+= -DP_HPUX9
598 ####################################################
600 ifeq ($(OSTYPE
),Darwin
)
602 # MacOS X or later / Darwin
604 CFLAGS
+= -fno-common
-dynamic
605 LDFLAGS
+= -multiply_defined suppress
606 ifeq ($(OSRELEASE
), 700)
607 ENDLDLIBS
+= -lresolv
609 ENDLDLIBS
+= -framework AudioToolbox
-framework CoreAudio
611 # Quicktime support is still a long way off. But for development purposes,
612 # I am inluding the flags to allow QuickTime to be linked.
613 # Uncomment them if you wish, but it will do nothing for the time being.
616 #STDCCFLAGS += -DHAS_QUICKTIMEX
617 #ENDLDLIBS += -framework QuickTime
619 ifeq ($(MACHTYPE
),x86
)
623 ARCHIVE
:= libtool
-static
-o
631 ifeq ($(OSTYPE
),Carbon
)
633 # MacOS 9 or X using Carbonlib calls
635 STDCCFLAGS
+= -DP_MACOS
637 # I'm having no end of trouble with the debug memory allocator.
640 # Carbon is only available for full Mac OS X, not pure Darwin, so the only
641 # currently available architecture is PPC.
643 STDCCFLAGS
+= -DP_MAC_MPTHREADS
644 LDLIBS
+= -prebind
-framework CoreServices
-framework QuickTime
-framework Carbon
654 ####################################################
656 ifeq ($(OSTYPE
),VxWorks
)
658 ifeq ($(MACHTYPE
),ARM
)
659 STDCCFLAGS
+= -mcpu
=arm8
-DCPU
=ARMARCH4
662 STDCCFLAGS
+= -DP_VXWORKS
-DPHAS_TEMPLATES
-DVX_TASKS
663 STDCCFLAGS
+= -DNO_LONG_DOUBLE
665 STDCCFLAGS
+= -Wno-multichar
-Wno-format
669 STDCCFLAGS
+= -DP_USE_PRAGMA
674 ####################################################
676 ifeq ($(OSTYPE
),rtems
)
678 CC
:= $(MACHTYPE
)-rtems-gcc
--pipe
679 CPLUS
:= $(MACHTYPE
)-rtems-g
++
680 #LD := $(MACHTYPE)-rtems-ld
681 #AR := $(MACHTYPE)-rtems-ar
682 #RUNLIB := $(MACHTYPE)-rtems-runlib
684 SYSLIBDIR
:= $(RTEMS_MAKEFILE_PATH
)/lib
685 SYSINCDIR
:= $(RTEMS_MAKEFILE_PATH
)/lib
/include
687 LDFLAGS
+= -B
$(SYSLIBDIR
)/ -specs
=bsp_specs
-qrtems
688 STDCCFLAGS
+= -B
$(SYSLIBDIR
)/ -specs
=bsp_specs
-ansi
-fasm
-qrtems
690 ifeq ($(CPUTYPE
),mcpu32
)
691 STDCCFLAGS
+= -mcpu32
695 ifeq ($(CPUTYPE
),mpc860
)
696 STDCCFLAGS
+= -mcpu
=860
700 STDCCFLAGS
+= -DP_RTEMS
-DP_HAS_SEMAPHORES
706 ####################################################
710 ifeq ($(MACHTYPE
),x86
)
711 STDCCFLAGS
+= -Wc
,-m486
714 STDCCFLAGS
+= -DP_QNX
-DP_HAS_RECURSIVE_MUTEX
=1 -DFD_SETSIZE
=1024
716 ENDLDLIBS
+= -lsocket
-lstdc
++
718 CC
:= qcc
-Vgcc_ntox86
719 CPLUS
:= qcc
-Vgcc_ntox86_gpp
722 STDCCFLAGS
+= -DP_USE_PRAGMA
724 ifeq ($(P_SHAREDLIB
),1)
725 STDCCFLAGS
+= -shared
730 ####################################################
732 ifeq ($(OSTYPE
),Nucleus
)
735 STDCCFLAGS
+= -msoft-float
-nostdinc
-g
736 STDCCFLAGS
+= -D__NUCLEUS_PLUS__
-D__ppc
-DWOT_NO_FILESYSTEM
-DPLUS \
737 -D__HAS_NO_FLOAT
-D__USE_STL__ \
739 -D__NUCLEUS_NET__
-D__NEWLIB__ \
745 NUCLEUSDIR
= ${WORK}/embedded
/os
/Nucleus
748 STLDIR
= ${WORK}/embedded
/packages
/stl-3.2
-stream
750 STDCCFLAGS
+= -I
$(NUCLEUSDIR
)/plus \
751 -I
$(NUCLEUSDIR
)/plusplus \
752 -I
$(NUCLEUSDIR
)/net \
754 -I
$(PWLIBDIR
)/include/ptlib
/Nucleus
++ \
755 -I
$(WORK
)/embedded
/libraries
/socketshim
/BerkleySockets \
757 -I
/usr
/local
/powerpc-motorola-eabi
/include \
758 -I
${WORK}/embedded
/libraries
/configuration
760 UNIX_SRC_DIR
= $(PWLIBDIR
)/src
/ptlib
/Nucleus
++
765 ###############################################################################
767 # Make sure some things are defined
803 # Further configuration
810 PLATFORM_TYPE
= $(OSTYPE
)_
$(MACHTYPE
)
812 PLATFORM_TYPE
= $(OSTYPE
)_
$(PTLIB_ALT
)_
$(MACHTYPE
)
824 OBJDIR_SUFFIX
= $(OBJ_SUFFIX
)
831 ifeq ($(P_SHAREDLIB
),1)
832 LIB_SUFFIX
= $(SHAREDLIBEXT
)
840 INSTALL_DIR
= /usr
/local
843 ifndef INSTALLBIN_DIR
844 INSTALLBIN_DIR
= $(INSTALL_DIR
)/bin
847 ifndef INSTALLLIB_DIR
848 INSTALLLIB_DIR
= $(INSTALL_DIR
)/lib
852 ###############################################################################
854 # define some common stuff
861 # Required macro symbols
866 UNIX_INC_DIR
= $(PREFIX
)/include/ptlib
/unix
868 UNIX_INC_DIR
= $(PWLIBDIR
)/include/ptlib
/unix
872 UNIX_SRC_DIR
= $(PWLIBDIR
)/src
/ptlib
/unix
875 PW_LIBDIR
= $(PWLIBDIR
)/lib
877 # set name of the PT library
878 PTLIB_BASE
= pt_
$(PLATFORM_TYPE
)_
$(OBJ_SUFFIX
)
879 PTLIB_FILE
= lib
$(PTLIB_BASE
)$(LIB_TYPE
).
$(LIB_SUFFIX
)
880 PT_OBJBASE
= obj_
$(PLATFORM_TYPE
)_
$(OBJDIR_SUFFIX
)
881 PT_OBJDIR
= $(PW_LIBDIR
)/$(PT_OBJBASE
)
883 # set name of the PW library (may not be used)
884 PWLIB_BASE
= pw_
$(GUI_TYPE
)_
$(PLATFORM_TYPE
)_
$(OBJ_SUFFIX
)
885 PWLIB_FILE
= lib
$(PWLIB_BASE
)$(LIB_TYPE
).
$(LIB_SUFFIX
)
886 PW_OBJBASE
= obj_
$(GUI_TYPE
)_
$(PLATFORM_TYPE
)_
$(OBJDIR_SUFFIX
)
887 PW_OBJDIR
= $(PW_LIBDIR
)/$(PW_OBJBASE
)
889 ###############################################################################
891 # Set up compiler flags and macros for debug/release versions
900 STDCCFLAGS
+= $(DEBUG_FLAG
) -D_DEBUG
-DNDEBUG
901 LDFLAGS
+= $(DEBLDFLAGS
)
905 ifneq ($(OSTYPE
),Darwin
)
911 ifneq ($(OSTYPE
),Carbon
)
912 ifneq ($(OSTYPE
),Darwin
)
913 # Apple does not support -s to remove symbol table/relocation information
920 # define ESDDIR variables if installed
922 STDCCFLAGS
+= -I
$(ESDDIR
)/include -DUSE_ESD
=1
923 ENDLDLIBS
+= $(ESDDIR
)/lib
/libesd.a
# to avoid name conflicts
927 # feature migrated to configure.in
928 # #define templates if available
929 # ifndef NO_PWLIB_TEMPLATES
930 # STDCCFLAGS += -DPHAS_TEMPLATES
933 # compiler flags for all modes
934 #STDCCFLAGS += -fomit-frame-pointer
935 #STDCCFLAGS += -fno-default-inline
936 #STDCCFLAGS += -Woverloaded-virtual
937 #STDCCFLAGS += -fno-implement-inlines
939 # add OS directory to include path
940 # STDCCFLAGS += -I$(UNIX_INC_DIR) # removed CRS
943 # add library directory to library path and include the library
944 LDFLAGS
+= -L
$(PW_LIBDIR
)
946 LDLIBS
+= -l
$(PTLIB_BASE
)$(LIB_TYPE
)