summaryrefslogtreecommitdiff
path: root/include/makeinclude/platform_freebsd.GNU
blob: a40ffbef07e7495c6fbd01343469752589d681ac (plain)
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
# $Id$

# platform_freebsd.GNU

##  See /usr/ports/Mk/bsd.port.mk for sample usage of the OSVERSION
##  variable, especially with respect to defining the correct compiler
##  flags for threads.
OSVERSION := $(shell sysctl -n kern.osreldate)

## GNU make does not support boolean conditional expressions
## so we have to use a dummy RET variable.
RET = $(shell test $(OSVERSION) -ge 200000 && printf 1)
ifeq ($(RET),1)
versioned_so = 1
endif

exceptions ?= 1
threads ?= 1
debug ?= 1
optimize ?= 1
pipes ?= 1

CC              = gcc
CXX             = g++

CFLAGS          += -W -Wall -Wpointer-arith
DCFLAGS         += -g
RET = $(shell test $(OSVERSION) -ge 300000 && printf 1)
ifneq ($(RET),1)
  LDFLAGS       += -Wl,-rpath $(ACE_ROOT)/lib
endif
DLD             = $(CXX)
LD              = $(CXX)
OCFLAGS         += -O2
PIC             = -fpic
AR              = ar
ARFLAGS         = ruv
RANLIB          = ranlib

SOFLAGS += $(CPPFLAGS) -shared
SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<
PRELIB = @echo

## Set the correct compiler flags for pthreads.  This
## test is copied from /usr/ports/Mk/bsd.port.mk
ifeq ($(threads),1)
RET = $(shell test $(OSVERSION) -lt 500016 && printf 1)
ifeq ($(RET),1)
  PTHREAD_CFLAGS = -D_THREAD_SAFE
  PTHREAD_LIBS   = -pthread
else
  RET = $(shell test $(OSVERSION) -lt 502102 && printf 1)
  ifeq ($(RET),1)
  PTHREAD_LIBS   = -lc_r
  else
  PTHREAD_LIBS   = -lpthread
  endif
endif # RET

CFLAGS  += $(PTHREAD_CFLAGS)
LIBS += $(PTHREAD_LIBS)

endif # threads

# Test for template instantiation, add to SOFLAGS if SONAME set,
# add -E to LDFLAGS if using GNU ld
#
include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU

CCFLAGS         += $(CFLAGS) $(TEMPLATES_FLAG)