OSDN Git Service

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