Added fail safe delay as some camera drivers ignore the frame rate
[pwlib.git] / make / unix.mak
bloba16a36454e1856b589e364be21c2f376a0dc6805
2 # unix.mak
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
20 # under the License.
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): ______________________________________.
31 # $Log$
32 # Revision 1.203 2007/08/06 00:36:37 csoutheren
33 # NDEBUG is passed to opt builds, _DEBUG is passed to debug builds
35 # Revision 1.202 2006/06/27 11:52:14 csoutheren
36 # Patch 1509205 - Fixes typo in GCC flags under Solaris
37 # Thanks to Boris Pavacic
39 # Revision 1.201 2006/05/15 23:11:26 dereksmithies
40 # Use -ggdb -O0 -g3 to provide more information to the debugger, and force all
41 # optimisation to be off. Initial tests show: this improves linux debugging.
43 # Revision 1.200 2006/01/17 18:57:17 dsandras
44 # Applied patch from Brian Lu <brian lu sun com> to fix compilation with SUN
45 # studio. Thanks.
47 # Revision 1.199 2006/01/08 14:49:08 dsandras
48 # Several fixes to allow compilation on Open Solaris thanks to Brian Lu <brian.lu _AT_____ sun.com>. Many thanks!
50 # Revision 1.198 2005/12/04 22:50:50 csoutheren
51 # Applied patch for Alpha thanks to Kilian Krause
53 # Revision 1.197 2005/12/04 22:38:38 csoutheren
54 # Added patch for hppa64. Thanks to Kilian Krause
56 # Revision 1.196 2005/09/25 10:51:23 dominance
57 # almost complete the mingw support. We'll be there soon. ;)
59 # Revision 1.195 2005/02/23 21:29:52 dominance
60 # have configure check for bison as we know we'll need it and stop implicit definition of PWLIBDIR. *geesh* that was about time, eh? ;)
62 # Revision 1.194 2005/01/14 11:49:17 csoutheren
63 # Removed -s flag so executables are not stripped by default
65 # Revision 1.193 2004/11/16 00:32:34 csoutheren
66 # Added Cygwin support
68 # Revision 1.192 2004/10/28 20:07:10 csoutheren
69 # Fixes for MacOSX platforms, thanks to Hannes Friederich
71 # Revision 1.191 2004/08/31 23:52:31 csoutheren
72 # Changed check for Mac OS version, thanks to Hannes Friederich
74 # Revision 1.190 2004/06/18 00:38:08 csoutheren
75 # Added check for FD_SETSIZE as suggested by Joegen E. Baclor
77 # Revision 1.189 2004/06/10 01:36:44 csoutheren
78 # Fixed problems with static links
80 # Revision 1.188 2004/05/30 04:49:42 ykiryanov
81 # Streamlined BeOS section
83 # Revision 1.187 2004/04/25 22:11:34 ykiryanov
84 # Added posix library to make files
86 # Revision 1.186 2004/04/21 03:47:36 ykiryanov
87 # Added libdl.so to library list for BeOS
89 # Revision 1.185 2004/04/12 03:35:27 csoutheren
90 # Fixed problems with non-recursuve mutexes and critical sections on
91 # older compilers and libc
93 # Revision 1.184 2004/02/26 11:19:07 csoutheren
94 # Added changes for BeOS, thanks to Yuri Kiryanov
95 # Added changes to fix link problems on some platforms, thanks to Klaus Kaempf
97 # Revision 1.183 2004/02/21 19:44:54 ykiryanov
98 # Fixed make parameters for BeOS: Changed default on BeOS to using Be BONE
100 # Revision 1.182 2004/02/11 05:09:14 csoutheren
101 # Fixed problems with regex libraries on Solaris, and with host OS numbering
102 # being a quoted string rather than a number. Thanks to Chad Attermann
103 # Fixed problems SSL detection problems thanks to Michal Zygmuntowicz
105 # Revision 1.181 2004/02/09 06:24:37 csoutheren
106 # Allowed CXX environment variable to define C++ compiler to use
107 # as required by configure
109 # Revision 1.180 2004/01/29 13:43:59 csoutheren
110 # Moved some preprocessor symbols from the command line to include files
111 # Modified to set P_HAS_SEMAPHORES to 0 for Linux kernels >= 2.6
112 # Applied patches for Solaris thanks to Michal Zygmuntowicz
114 # Revision 1.179 2003/11/02 16:00:26 shawn
115 # Panther requires -lresolv
117 # Revision 1.178 2003/09/18 23:02:35 csoutheren
118 # Removed definition of PMEMORY_CHECK
120 # Revision 1.177 2003/09/17 01:18:03 csoutheren
121 # Removed recursive include file system and removed all references
122 # to deprecated coooperative threading support
124 # Revision 1.176 2003/09/08 21:11:09 dereksmithies
125 # Remove hardcoded path from make file. Thanks Damien Sandras.
127 # Revision 1.175 2003/07/24 22:01:42 dereksmithies
128 # Add fixes from Peter Nixon for fixing install problems. Thanks.
130 # Revision 1.174 2003/06/18 13:19:01 csoutheren
131 # Default debug builds now shared
133 # Revision 1.173 2003/06/17 12:05:01 csoutheren
134 # Changed compiler flags for optimised build
136 # Revision 1.172 2003/05/22 12:17:06 dsandras
138 # Removed unneeded code since Firewire support has been moved to configure.
140 # Revision 1.171 2003/05/06 09:47:20 robertj
141 # Fixed up MacOSX changes so is compatible with previous "API" not requiring
142 # downstream libraries to change
144 # Revision 1.170 2003/05/06 06:59:12 robertj
145 # Dynamic library support for MacOSX, thanks Hugo Santos
147 # Revision 1.169 2003/05/05 13:10:59 robertj
148 # Solaris compatibility
150 # Revision 1.168 2003/04/17 07:29:27 robertj
151 # Fixed solaris link problem
153 # Revision 1.167 2003/04/17 00:05:04 craigs
154 # Added patches from Hugo Santos mainly for Darwin compatibility
156 # Revision 1.166 2003/04/16 07:16:55 craigs
157 # Modified for new autoconf based configuration
160 # Log truncated by CRS 14 April 2003
163 ifndef PWLIBDIR
164 echo "No PWLIBDIR environment variable defined!"
165 echo "You need to define PWLIBDIR!"
166 echo "Try something like:"
167 echo "PWLIBDIR = $(HOME)/pwlib"
168 exit 1
169 endif
171 ####################################################
173 # include generated build options file, then include it
174 include $(PWLIBDIR)/make/ptbuildopts.mak
176 ###############################################################################
178 # this section used to normalise the machine name and OS type
179 # this is now done by autoconf - but this left here as a reference
183 ifdef USE_OLD_MACHINE_CHECKING
185 ifndef OSTYPE
186 OSTYPE := $(shell uname -s)
187 endif
189 ifndef MACHTYPE
190 MACHTYPE := $(shell uname -m)
191 endif
193 ifneq (,$(findstring linux,$(HOSTTYPE)))
194 ifneq (,$(findstring $(HOSTTYPE),i386-linux i486-linux))
195 OSTYPE := linux
196 MACHTYPE := x86
197 endif
198 endif
200 ifeq ($(OSTYPE),mklinux)
201 OSTYPE := linux
202 MACHTYPE := ppc
203 endif
205 ifneq (,$(findstring $(OSTYPE),Linux linux-gnu))
206 OSTYPE := linux
207 endif
209 ifneq (,$(findstring $(OSTYPE),Solaris SunOS))
210 OSTYPE := solaris
211 endif
213 ifneq (,$(findstring $(OSTYPE),IRIX))
214 OSTYPE := irix
215 endif
217 #Convert bash shell OSTYPE of 'freebsd3.4' to 'FreeBSD'
218 ifneq (,$(findstring freebsd,$(OSTYPE)))
219 OSTYPE := FreeBSD
220 endif
222 #Convert bash shell OSTYPE of 'openbsd2.6' to 'OpenBSD'
223 ifneq (,$(findstring openbsd,$(OSTYPE)))
224 OSTYPE := OpenBSD
225 endif
227 ifneq (,$(findstring macos,$(OSTYPE)))
228 OSTYPE := Darwin
229 endif
231 ifneq (,$(findstring darwin,$(OSTYPE)))
232 OSTYPE := Darwin
233 endif
235 ifneq (,$(findstring AIX,$(OSTYPE)))
236 MACHTYPE := ppc
237 endif
239 ifneq (,$(findstring $(OS),VXWORKS))
240 OSTYPE := VxWorks
241 endif
243 ifneq (,$(findstring netbsd,$(OSTYPE)))
244 OSTYPE := NetBSD
245 endif
247 ifneq (,$(findstring sparc, $(MACHTYPE)))
248 MACHTYPE := sparc
249 endif
251 ifneq (,$(findstring sun4, $(MACHTYPE)))
252 MACHTYPE := sparc
253 endif
255 ifneq (,$(findstring i86, $(MACHTYPE)))
256 MACHTYPE := x86
257 endif
259 ifneq (,$(findstring i386, $(MACHTYPE)))
260 MACHTYPE := x86
261 endif
263 ifneq (,$(findstring i486, $(MACHTYPE)))
264 MACHTYPE := x86
265 POSSIBLE_CPUTYPE := i486
266 endif
268 ifneq (,$(findstring i586, $(MACHTYPE)))
269 MACHTYPE := x86
270 POSSIBLE_CPUTYPE := i586
271 endif
273 ifneq (,$(findstring i686, $(MACHTYPE)))
274 MACHTYPE := x86
275 POSSIBLE_CPUTYPE := i686
276 endif
278 #make sure x86 does not match x86_64 by mistake
279 ifneq (,$(findstring x86, $(MACHTYPE)))
280 ifneq (,$(findstring x86_64, $(MACHTYPE)))
281 MACHTYPE := x86_64
282 else
283 MACHTYPE := x86
284 endif
285 endif
287 ifneq (,$(findstring powerpc, $(MACHTYPE)))
288 MACHTYPE := ppc
289 endif
291 ifneq (,$(findstring ppc, $(MACHTYPE)))
292 ifneq (,$(findstring ppc64, $(MACHTYPE)))
293 MACHTYPE := ppc64
294 else
295 MACHTYPE := ppc
296 endif
297 endif
299 ifneq (,$(findstring Power, $(MACHTYPE)))
300 MACHTYPE := ppc
301 endif
303 ifneq (,$(findstring mips, $(MACHTYPE)))
304 MACHTYPE := mips
305 endif
307 ifneq (,$(findstring alpha, $(MACHTYPE)))
308 MACHTYPE := alpha
309 endif
311 ifneq (,$(findstring sparc, $(MACHTYPE)))
312 MACHTYPE := sparc
313 endif
315 ifneq (,$(findstring ia64, $(MACHTYPE)))
316 MACHTYPE := ia64
317 endif
319 ifneq (,$(findsting hppa64, $(MACHTYPE)))
320 MACHTYPE := hppa64
321 endif
323 ifneq (,$(findstring s390, $(MACHTYPE)))
324 ifneq (,$(findstring s390x, $(MACHTYPE)))
325 MACHTYPE := s390x
326 else
327 MACHTYPE := s390
328 endif
329 endif
331 ifneq (,$(findstring armv4l, $(MACHTYPE)))
332 MACHTYPE := armv4l
333 endif
334 ifndef CPUTYPE
335 CPUTYPE := $(POSSIBLE_CPUTYPE)
336 export CPUTYPE
337 endif
340 endif # USE_OLD_MACHINE_CHECKING
342 STANDARD_TARGETS=\
343 opt debug both \
344 optdepend debugdepend bothdepend \
345 optshared debugshared bothshared \
346 optnoshared debugnoshared bothnoshared \
347 optclean debugclean clean \
348 release tagbuild
350 .PHONY: all $(STANDARD_TARGETS)
353 ifeq (,$(findstring $(OSTYPE),linux FreeBSD OpenBSD NetBSD solaris beos Darwin Carbon AIX Nucleus VxWorks rtems QNX cygwin mingw))
355 default_target :
356 @echo
357 @echo ######################################################################
358 @echo "Warning: OSTYPE=$(OSTYPE) support has not been confirmed. This may"
359 @echo " be a new operating system not yet encountered, or more"
360 @echo " likely, the OSTYPE and MACHTYPE environment variables are"
361 @echo " set to unusual values. You may need to explicitly set these"
362 @echo " variables for the correct operation of this system."
363 @echo
364 @echo " Currently supported OSTYPE names are:"
365 @echo " linux Linux linux-gnu mklinux"
366 @echo " solaris Solaris SunOS"
367 @echo " FreeBSD OpenBSD NetBSD beos Darwin Carbon"
368 @echo " VxWorks rtems mingw"
369 @echo
370 @echo " **********************************"
371 @echo " *** DO NOT IGNORE THIS MESSAGE ***"
372 @echo " **********************************"
373 @echo
374 @echo " The system almost certainly will not compile! When you get"
375 @echo " it working please send patches to support@equival.com.au"
376 @echo ######################################################################
377 @echo
379 $(STANDARD_TARGETS) :: default_target
381 else
383 default_target : help
385 endif
387 ####################################################
389 # Set default for shared library usage
391 ifndef P_SHAREDLIB
392 P_SHAREDLIB=1
393 else
394 P_SHAREDLIB=0
395 endif
397 # -Wall must be at the start of the options otherwise
398 # any -W overrides won't have any effect
399 ifeq ($(USE_GCC),yes)
400 STDCCFLAGS += -Wall
401 endif
403 ifdef RPM_OPT_FLAGS
404 STDCCFLAGS += $(RPM_OPT_FLAGS)
405 endif
407 ifneq ($(OSTYPE),rtems)
408 ifndef SYSINCDIR
409 SYSINCDIR := /usr/include
410 endif
411 endif
413 ####################################################
415 ifeq ($(OSTYPE),linux)
417 ifeq ($(MACHTYPE),x86)
418 ifdef CPUTYPE
419 ifeq ($(CPUTYPE),crusoe)
420 STDCCFLAGS += -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -malign-functions=0
421 STDCCFLAGS += -malign-jumps=0 -malign-loops=0
422 else
423 STDCCFLAGS += -mcpu=$(CPUTYPE)
424 endif
425 endif
426 endif
428 ifeq ($(MACHTYPE),ia64)
429 STDCCFLAGS += -DP_64BIT
430 endif
432 ifeq ($(MACHTYPE),hppa64)
433 STDCCFLAGS += -DP_64BIT
434 endif
436 ifeq ($(MACHTYPE),s390x)
437 STDCCFLAGS += -DP_64BIT
438 endif
440 ifeq ($(MACHTYPE),x86_64)
441 STDCCFLAGS += -DP_64BIT
442 LDLIBS += -lresolv
443 endif
445 ifeq ($(MACHTYPE),ppc64)
446 STDCCFLAGS += -DP_64BIT
447 endif
449 ifeq ($(P_SHAREDLIB),1)
450 ifndef PROG
451 STDCCFLAGS += -fPIC -DPIC
452 endif # PROG
453 endif # P_SHAREDLIB
456 STATIC_LIBS := libstdc++.a libg++.a libm.a libc.a
457 SYSLIBDIR := $(shell $(PWLIBDIR)/make/ptlib-config --libdir)
459 endif # linux
462 ####################################################
464 ifeq ($(OSTYPE),FreeBSD)
466 ifeq ($(MACHTYPE),x86)
467 ifdef CPUTYPE
468 STDCCFLAGS += -mcpu=$(CPUTYPE)
469 endif
470 endif
472 P_USE_RANLIB := 1
473 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
476 endif # FreeBSD
479 ####################################################
481 ifeq ($(OSTYPE),OpenBSD)
483 ifeq ($(MACHTYPE),x86)
484 STDCCFLAGS += -m486
485 endif
487 LDLIBS += -lossaudio
489 P_USE_RANLIB := 1
490 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
493 endif # OpenBSD
496 ####################################################
498 ifeq ($(OSTYPE),NetBSD)
500 ifeq ($(MACHTYPE),x86)
501 STDCCFLAGS += -m486
502 endif
504 LDLIBS += -lossaudio
506 STDCCFLAGS += -I$(UNIX_INC_DIR) -I$(PWLIBDIR)/include
508 # enable the USE_PTH line to compile using pth
509 # enable the USE_NATIVE_THREADS line to compile using native threads
510 # enable the USE_UNPROVEN_THREADS line to compile using unproven threads
511 #USE_PTH_THREADS := 1
512 #USE_UNPROVEN_THREADS := 1
513 USE_NATIVE_THREADS := 1
515 ifdef P_PTHREADS
516 ifdef USE_NATIVE_THREADS
517 LDLIBS += -lpthread
518 else
519 ifdef USE_PTH_THREADS
520 STDCCFLAGS += -DP_GNU_PTH
521 STDCCFLAGS += -I/usr/pkg/include
522 LDFLAGS += -L/usr/pkg/lib
523 LDLIBS += -lpthread
524 else
525 STDCCFLAGS += -DP_NO_CANCEL
526 STDCCFLAGS += -I/usr/pkg/pthreads/include
527 LDFLAGS += -L/usr/pkg/pthreads/lib
528 LDLIBS += -lpthread
529 CC := /usr/pkg/pthreads/bin/pgcc
530 CPLUS := /usr/pkg/pthreads/bin/pg++
531 endif
532 endif
533 endif
535 P_USE_RANLIB := 1
536 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
539 endif # NetBSD
542 ####################################################
544 ifeq ($(OSTYPE),AIX)
546 STDCCFLAGS += -DP_AIX
547 # -pedantic -g
548 # LDLIBS += -lossaudio
550 STDCCFLAGS += -mminimal-toc
552 #P_USE_RANLIB := 1
553 STDCCFLAGS += -DP_USE_PRAGMA
556 endif # AIX
559 ####################################################
561 ifeq ($(OSTYPE),sunos)
563 # Sparc Sun 4x, using gcc 2.7.2
565 P_USE_RANLIB := 1
566 REQUIRES_SEPARATE_SWITCH = 1
567 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
569 endif # sunos
572 ####################################################
574 ifeq ($(OSTYPE),solaris)
576 # Solaris (Sunos 5.x)
578 CFLAGS +=-DSOLARIS
579 CXXFLAGS +=-DSOLARIS
581 ifeq ($(MACHTYPE),x86)
582 ifeq ($(USE_GCC),yes)
583 DEBUG_FLAG := -gstabs+
584 CFLAGS += -DUSE_GCC
585 CXXFLAGS += -DUSE_GCC
586 endif
587 endif
589 ENDLDLIBS += -lsocket -lnsl -ldl -lposix4
591 # Sparc Solaris 2.x, using gcc 2.x
592 #Brian CC := gcc
594 #P_USE_RANLIB := 1
596 #STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
598 STATIC_LIBS := libstdc++.a libg++.a
599 SYSLIBDIR := /opt/openh323/lib
601 # Rest added by jpd@louisiana.edu, to get .so libs created!
602 ifndef DEBUG
603 ifndef P_SHAREDLIB
604 P_SHAREDLIB=1
605 ifndef PROG
606 STDCCFLAGS += -fPIC -DPIC
607 endif # PROG
608 endif
609 endif
611 endif # solaris
613 ####################################################
615 ifeq ($(OSTYPE),irix)
617 # should work whith Irix 6.5
619 # IRIX using a gcc
620 CC := gcc
621 STDCCFLAGS += -DP_IRIX
622 LDLIBS += -lsocket -lnsl
624 STDCCFLAGS += -DP_USE_PRAGMA
626 endif # irix
629 ####################################################
631 ifeq ($(OSTYPE),beos)
633 SYSLIBS += -lbe -lmedia -lgame -lroot -lsocket -lbind -ldl
634 STDCCFLAGS += -DBE_THREADS -DP_USE_PRAGMA -Wno-multichar -Wno-format
635 LDLIBS += $(SYSLIBS)
637 MEMORY_CHECK := 0
638 endif # beos
641 ####################################################
643 ifeq ($(OSTYPE),ultrix)
645 # R2000 Ultrix 4.2, using gcc 2.7.x
646 STDCCFLAGS += -DP_ULTRIX
647 STDCCFLAGS += -DP_USE_PRAGMA
648 endif # ultrix
651 ####################################################
653 ifeq ($(OSTYPE),hpux)
654 STDCCFLAGS += -DP_USE_PRAGMA
655 # HP/UX 9.x, using gcc 2.6.C3 (Cygnus version)
656 STDCCFLAGS += -DP_HPUX9
658 endif # hpux
661 ####################################################
663 ifeq ($(OSTYPE),Darwin)
665 # MacOS X or later / Darwin
667 CFLAGS += -fno-common -dynamic
668 LDFLAGS += -multiply_defined suppress
669 ENDLDLIBS += -lresolv -framework AudioToolbox -framework CoreAudio
670 ENDLDLIBS += -framework AudioUnit -framework CoreServices
671 STDCCFLAGS += -D__MACOSX__
673 # Quicktime support is still a long way off. But for development purposes,
674 # I am inluding the flags to allow QuickTime to be linked.
675 # Uncomment them if you wish, but it will do nothing for the time being.
677 #HAS_QUICKTIMEX := 1
678 #STDCCFLAGS += -DHAS_QUICKTIMEX
679 #ENDLDLIBS += -framework QuickTime
681 ifeq ($(MACHTYPE),x86)
682 STDCCFLAGS += -m486
683 endif
685 ARCHIVE := libtool -static -o
686 P_USE_RANLIB := 0
688 CC := cc
689 CPLUS := c++
691 endif # Darwin
693 ifeq ($(OSTYPE),Carbon)
695 # MacOS 9 or X using Carbonlib calls
697 STDCCFLAGS += -DP_MACOS
699 # I'm having no end of trouble with the debug memory allocator.
700 MEMORY_CHECK := 0
702 # Carbon is only available for full Mac OS X, not pure Darwin, so the only
703 # currently available architecture is PPC.
704 P_MAC_MPTHREADS := 1
705 STDCCFLAGS += -DP_MAC_MPTHREADS
706 LDLIBS += -prebind -framework CoreServices -framework QuickTime -framework Carbon
708 P_SHAREDLIB := 0
709 P_USE_RANLIB := 1
711 CC := cc
712 CPLUS := c++
714 endif # Carbon
716 ####################################################
718 ifeq ($(OSTYPE),VxWorks)
720 ifeq ($(MACHTYPE),ARM)
721 STDCCFLAGS += -mcpu=arm8 -DCPU=ARMARCH4
722 endif
724 STDCCFLAGS += -DP_VXWORKS -DPHAS_TEMPLATES -DVX_TASKS
725 STDCCFLAGS += -DNO_LONG_DOUBLE
727 STDCCFLAGS += -Wno-multichar -Wno-format
729 MEMORY_CHECK := 0
731 STDCCFLAGS += -DP_USE_PRAGMA
733 endif # VxWorks
736 ####################################################
738 ifeq ($(OSTYPE),rtems)
740 CC := $(MACHTYPE)-rtems-gcc --pipe
741 CPLUS := $(MACHTYPE)-rtems-g++
742 #LD := $(MACHTYPE)-rtems-ld
743 #AR := $(MACHTYPE)-rtems-ar
744 #RUNLIB := $(MACHTYPE)-rtems-runlib
746 SYSLIBDIR := $(RTEMS_MAKEFILE_PATH)/lib
747 SYSINCDIR := $(RTEMS_MAKEFILE_PATH)/lib/include
749 LDFLAGS += -B$(SYSLIBDIR)/ -specs=bsp_specs -qrtems
750 STDCCFLAGS += -B$(SYSLIBDIR)/ -specs=bsp_specs -ansi -fasm -qrtems
752 ifeq ($(CPUTYPE),mcpu32)
753 STDCCFLAGS += -mcpu32
754 LDFLAGS += -mcpu32
755 endif
757 ifeq ($(CPUTYPE),mpc860)
758 STDCCFLAGS += -mcpu=860
759 LDFLAGS += -mcpu=860
760 endif
762 STDCCFLAGS += -DP_RTEMS -DP_HAS_SEMAPHORES
764 P_SHAREDLIB := 0
766 endif # rtems
768 ####################################################
770 ifeq ($(OSTYPE),QNX)
772 ifeq ($(MACHTYPE),x86)
773 STDCCFLAGS += -Wc,-m486
774 endif
776 STDCCFLAGS += -DP_QNX -DP_HAS_RECURSIVE_MUTEX=1 -DFD_SETSIZE=1024
777 LDLIBS += -lasound
778 ENDLDLIBS += -lsocket -lstdc++
780 CC := qcc -Vgcc_ntox86
781 CPLUS := qcc -Vgcc_ntox86_gpp
783 P_USE_RANLIB := 1
784 STDCCFLAGS += -DP_USE_PRAGMA
786 ifeq ($(P_SHAREDLIB),1)
787 ifeq ($(USE_GCC),yes)
788 STDCCFLAGS += -shared
789 else
790 ifeq ($(OSTYPE),solaris)
791 STDCCFLAGS += -G
792 endif
793 endif
795 endif
797 endif # QNX6
799 ####################################################
801 ifeq ($(OSTYPE),Nucleus)
803 # Nucleus using gcc
804 STDCCFLAGS += -msoft-float -nostdinc $(DEBUGFLAGS)
805 STDCCFLAGS += -D__NUCLEUS_PLUS__ -D__ppc -DWOT_NO_FILESYSTEM -DPLUS \
806 -D__HAS_NO_FLOAT -D__USE_STL__ \
807 -D__USE_STD__ \
808 -D__NUCLEUS_NET__ -D__NEWLIB__ \
809 -DP_USE_INLINES=0
810 ifndef WORK
811 WORK = ${HOME}/work
812 endif
813 ifndef NUCLEUSDIR
814 NUCLEUSDIR = ${WORK}/embedded/os/Nucleus
815 endif
816 ifndef STLDIR
817 STLDIR = ${WORK}/embedded/packages/stl-3.2-stream
818 endif
819 STDCCFLAGS += -I$(NUCLEUSDIR)/plus \
820 -I$(NUCLEUSDIR)/plusplus \
821 -I$(NUCLEUSDIR)/net \
822 -I$(NUCLEUSDIR) \
823 -I$(PWLIBDIR)/include/ptlib/Nucleus++ \
824 -I$(WORK)/embedded/libraries/socketshim/BerkleySockets \
825 -I${STLDIR} \
826 -I/usr/local/powerpc-motorola-eabi/include \
827 -I${WORK}/embedded/libraries/configuration
829 UNIX_SRC_DIR = $(PWLIBDIR)/src/ptlib/Nucleus++
830 MEMORY_CHECK = 0
831 endif # Nucleus
833 ####################################################
835 ifeq ($(OSTYPE),mingw)
836 LDFLAGS += -enable-auto-import -enable-runtime-pseudo-reloc
837 LDFLAGS += -enable-stdcall-fixup -fatal-warning
838 endif # mingw
840 ###############################################################################
842 # Make sure some things are defined
845 ifndef CC
846 CC := gcc
847 endif
849 ifndef CPLUS
850 ifndef CXX
851 CPLUS := g++
852 else
853 CPLUS := $(CXX)
854 endif
855 endif
857 ifndef INSTALL
858 INSTALL := install
859 endif
861 ifndef AR
862 AR := ar
863 endif
865 ifndef ARCHIVE
866 ifdef P_USE_RANLIB
867 ARCHIVE := $(AR) rc
868 else
869 ARCHIVE := $(AR) rcs
870 endif
871 endif
873 ifndef RANLIB
874 RANLIB := ranlib
875 endif
878 # Further configuration
880 ifndef DEBUG_FLAG
881 DEBUG_FLAG := -g
882 endif
884 ifndef PTLIB_ALT
885 PLATFORM_TYPE = $(OSTYPE)_$(MACHTYPE)
886 else
887 PLATFORM_TYPE = $(OSTYPE)_$(PTLIB_ALT)_$(MACHTYPE)
888 endif
890 ifndef OBJ_SUFFIX
891 ifdef DEBUG
892 OBJ_SUFFIX := d
893 else
894 OBJ_SUFFIX := r
895 endif # DEBUG
896 endif # OBJ_SUFFIX
898 ifndef OBJDIR_SUFFIX
899 OBJDIR_SUFFIX = $(OBJ_SUFFIX)
900 endif
902 ifndef STATICLIBEXT
903 STATICLIBEXT = a
904 endif
906 ifeq ($(P_SHAREDLIB),1)
907 LIB_SUFFIX = $(SHAREDLIBEXT)
908 LIB_TYPE =
909 else
910 LIB_SUFFIX = a
911 LIB_TYPE = _s
912 endif # P_SHAREDLIB
914 ifndef INSTALL_DIR
915 INSTALL_DIR = /usr/local
916 endif
918 ifndef INSTALLBIN_DIR
919 INSTALLBIN_DIR = $(INSTALL_DIR)/bin
920 endif
922 ifndef INSTALLLIB_DIR
923 INSTALLLIB_DIR = $(INSTALL_DIR)/lib
924 endif
927 ###############################################################################
929 # define some common stuff
932 SHELL := /bin/sh
934 .SUFFIXES: .cxx .prc
936 # Required macro symbols
938 # Directories
940 ifdef PREFIX
941 UNIX_INC_DIR = $(PREFIX)/include/ptlib/unix
942 else
943 UNIX_INC_DIR = $(PWLIBDIR)/include/ptlib/unix
944 endif
946 ifndef UNIX_SRC_DIR
947 UNIX_SRC_DIR = $(PWLIBDIR)/src/ptlib/unix
948 endif
950 PW_LIBDIR = $(PWLIBDIR)/lib
952 # set name of the PT library
953 PTLIB_BASE = pt_$(PLATFORM_TYPE)_$(OBJ_SUFFIX)
954 PTLIB_FILE = lib$(PTLIB_BASE)$(LIB_TYPE).$(LIB_SUFFIX)
955 PT_OBJBASE = obj_$(PLATFORM_TYPE)_$(OBJDIR_SUFFIX)
956 PT_OBJDIR = $(PW_LIBDIR)/$(PT_OBJBASE)
958 # set name of the PW library (may not be used)
959 PWLIB_BASE = pw_$(GUI_TYPE)_$(PLATFORM_TYPE)_$(OBJ_SUFFIX)
960 PWLIB_FILE = lib$(PWLIB_BASE)$(LIB_TYPE).$(LIB_SUFFIX)
961 PW_OBJBASE = obj_$(GUI_TYPE)_$(PLATFORM_TYPE)_$(OBJDIR_SUFFIX)
962 PW_OBJDIR = $(PW_LIBDIR)/$(PW_OBJBASE)
964 ###############################################################################
966 # Set up compiler flags and macros for debug/release versions
969 ifdef DEBUG
971 ifndef MEMORY_CHECK
972 MEMORY_CHECK := 1
973 endif
975 STDCCFLAGS += $(DEBUG_FLAG) -D_DEBUG
976 LDFLAGS += $(DEBLDFLAGS)
978 else
980 STDCCFLAGS += -DNDEBUG
982 ifneq ($(OSTYPE),Darwin)
983 ifeq ($(OSTYPE),solaris)
984 OPTCCFLAGS += -O3
985 else
986 OPTCCFLAGS += -Os
987 endif
988 else
989 OPTCCFLAGS += -O2
990 endif
992 endif # DEBUG
994 # define ESDDIR variables if installed
995 ifdef ESDDIR
996 STDCCFLAGS += -I$(ESDDIR)/include -DUSE_ESD=1
997 ENDLDLIBS += $(ESDDIR)/lib/libesd.a # to avoid name conflicts
998 HAS_ESD = 1
999 endif
1001 # feature migrated to configure.in
1002 # #define templates if available
1003 # ifndef NO_PWLIB_TEMPLATES
1004 # STDCCFLAGS += -DPHAS_TEMPLATES
1005 # endif
1007 # compiler flags for all modes
1008 #STDCCFLAGS += -fomit-frame-pointer
1009 #STDCCFLAGS += -fno-default-inline
1010 #STDCCFLAGS += -Woverloaded-virtual
1011 #STDCCFLAGS += -fno-implement-inlines
1013 # add OS directory to include path
1014 # STDCCFLAGS += -I$(UNIX_INC_DIR) # removed CRS
1017 # add library directory to library path and include the library
1018 LDFLAGS += -L$(PW_LIBDIR)
1020 LDLIBS += -l$(PTLIB_BASE)$(LIB_TYPE)
1022 # End of unix.mak