summaryrefslogtreecommitdiff
path: root/ACE/include/makeinclude/platform_gnuwin32_common.GNU
blob: 22810d88f22851af4aa369232d10137e4052bbec (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
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
# -*- Makefile -*-
# $Id$

ifneq ($(mingw32),1)
  ifneq ($(cygwin32),1)
    fail := \
      $(shell \
          echo "You should not use this file but one of"; \
          echo "platform_mingw32.GNU or platform_cygwin32.GNU"; \
          exit 1)
  endif
endif

no_hidden_visibility ?= 1

GNUWIN32_CXX_VERSION := $(shell $(CXX) -dumpversion)

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

# When building shared libraries
ifeq ($(shared_libs), 1)
  ifneq ($(static_libs_only), 1)
    inline ?= 0
  endif
endif

ifeq ($(debug),0)
CFLAGS += -DNDEBUG
endif
CC      = ${COMPARCH}gcc
CXX     = ${COMPARCH}g++
RC      = ${COMPARCH}windres
DLLTOOL = ${COMPARCH}dlltool

RC_OUTPUT_FLAG = -o

ifeq (2.9,$(findstring 2.9,$(GNUWIN32_CXX_VERSION)))
  cpumodelflag ?= 1
  tunemodelflag ?= 0
else
  cpumodelflag ?= 0
  tunemodelflag ?= 1
endif

ifeq ($(tunemodelflag),1)
  MODEL_FLAGS += -mtune=$(TCPU)
endif

ifeq ($(cpumodelflag),1)
  MODEL_FLAGS += -mcpu=$(TCPU)
endif

CFLAGS += -Wpointer-arith
ifeq ($(threads),1)
  CFLAGS += -mthreads
endif # threads

CFLAGS += $(MODEL_FLAGS)

EXEEXT = .exe

DCFLAGS += -g
DLD     = $(CXX)
LD      = $(CXX)

ifeq ($(mingw32),1)
ifeq ($(winsock2),1)
LIBS    += -lws2_32 -lmswsock
endif
LIBS    += -lwsock32 -lnetapi32
endif

OCFLAGS += -O3
PIC        =
AR         = ${COMPARCH}ar
ARFLAGS    = rsuv
RANLIB     = ${COMPARCH}ranlib
SOEXT      = dll
SOFLAGS    += $(MODEL_FLAGS) $(CPPFLAGS)
SOBUILD    = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<

PLATFORM_FL_CPPFLAGS  ?=
PLATFORM_FL_LIBS      ?= -lfltk -lfltk_forms -lfltk_gl -lfltk_images
PLATFORM_FL_LDFLAGS   ?=

PLATFORM_GL_CPPFLAGS  ?= -I/usr/X11R6/include
PLATFORM_GL_LIBS      ?= -lGL
PLATFORM_GL_LDFLAGS   ?= -L/usr/X11R6/lib

PLATFORM_WX_CPPFLAGS  ?= $(shell wx-config --cxxflags) -I/usr/local/include
PLATFORM_WX_LIBS      ?= $(shell wx-config --libs)
PLATFORM_WX_LDFLAGS   ?= $(shell wx-config --ldflags)

# The sed below is to strip comments on the .def file,
# to workaround to a bug in ld.
CMDSEP ?= ;
SHLIBBUILD = \
  $(RM) $(VSHDIR)/$@.def.old $(VSHDIR)/$@.def $(CMDSEP) \
  $(DLLTOOL) --export-all --output-def $(VSHDIR)/$@.def --dllname $@ \
    $(VSHOBJS) \
  && mv $(VSHDIR)/$@.def $(VSHDIR)/$@.def.old \
  && sed "s/;.*$$//g" < $(VSHDIR)/$@.def.old > $(VSHDIR)/$@.def \
  && $(SOLINK.cc) -Wl,--enable-auto-image-base -Wl,--out-implib,$@.a \
    -shared -o $@ $(LDFLAGS) -Wl,$(VSHDIR)/$@.def \
    $(VSHOBJS) $(ACE_SHLIBS) $(LIBS)

PRELIB  = @true

# 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

ifeq ($(GXX_4_OR_BETTER), 1)
  no_attributes ?= 1
  wall ?= 1
else
  no_attributes ?= 0
  wall ?= 0
endif

ifeq ($(no_attributes), 1)
  CFLAGS += -Wno-attributes
endif

ifeq ($(wall),1)
  CFLAGS += -Wall -W
endif

CCFLAGS += $(CFLAGS) $(TEMPLATES_FLAG)