summaryrefslogtreecommitdiff
path: root/build/gcc3.2/XMPCore.mak
blob: d9ca7e200debdd86a020ea994304a00fa72beb12 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# ==================================================================================================
# Copyright 2002-2004 Adobe Systems Incorporated
# All Rights Reserved.
#
# NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the terms
# of the Adobe license agreement accompanying it.
# ==================================================================================================

# ==================================================================================================

# Define internal use variables.

Error =
TargetOS = ${OS}

ifeq "${TargetOS}" ""
	TargetOS = ${os}
endif

ifeq "${TargetOS}" ""
	TargetOS = ${MACHTYPE}${OSTYPE}
endif

ifeq "${TargetOS}" "i386linux"	# Linux ${MACHTYPE}${OSTYPE} is i386linux.
	TargetOS = i80386linux
endif

ifeq "${TargetOS}" "linux"
	TargetOS = i80386linux
endif

ifeq "${TargetOS}" "solaris"
	TargetOS = sparcsolaris
endif

ifneq "${TargetOS}" "i80386linux"
	ifneq "${TargetOS}" "sparcsolaris"
		Error += Invalid target OS "${TargetOS}"
	endif
endif

TargetStage = ${STAGE}

ifeq "${TargetStage}" ""
	TargetStage = ${stage}
endif

ifeq "${TargetStage}" ""
	TargetStage = debug
endif

ifneq "${TargetStage}" "debug"
	ifneq "${TargetStage}" "release"
		Error += Invalid target stage "${TargetStage}"
	endif
endif

ifeq "${TargetStage}" "debug"
   LibSuffix = StaticDebug
endif

ifeq "${TargetStage}" "release"
   LibSuffix = StaticRelease
endif

BuildRoot  = ../..
TargetRoot = ${BuildRoot}/public/libraries/${TargetOS}/${TargetStage}
TempRoot   = ${BuildRoot}/intermediate/${TargetOS}/${TargetStage}

HeaderRoot = ${BuildRoot}/public/include
SourceRoot = ${BuildRoot}/source
ExpatRoot  = ${BuildRoot}/third-party/expat
MD5Root    = ${BuildRoot}/third-party/MD5

LibName    = ${TargetRoot}/libXMPCore${LibSuffix}.a

# ==================================================================================================

CC  = gcc
CPP = gcc -x c++
AR  = ar -rs

CPPFLAGS = -Wno-multichar -Wno-implicit -Wno-ctor-dtor-privacy -funsigned-char -fexceptions
CPPFLAGS += -DUNIX_ENV=1 -DXMP_IMPL=1 -DXMP_ClientBuild=0 -D_FILE_OFFSET_BITS=64 -DHAVE_EXPAT_CONFIG_H=1 -DXML_STATIC=1

ifeq "${TargetOS}" "i80386linux"
	CPPFLAGS += -mtune=i686
endif

ifeq "${TargetOS}" "sparcsolaris"
	CPPFLAGS += -mtune=ultrasparc
endif

ifeq "$(TargetStage)" "debug"
	CPPFLAGS += -DDEBUG=1 -D_DEBUG=1 -g -O0
endif

ifeq "$(TargetStage)" "release"
	CPPFLAGS += -DNDEBUG=1 -O2 -Os
endif

# ==================================================================================================

CPPObjs = $(foreach objs,${CPPSources:.cpp=.o},${TempRoot}/$(objs))
CCObjs  = $(foreach objs,${CCSources:.c=.o},${TempRoot}/$(objs))

vpath %.incl_cpp \
    ${HeaderRoot}: \
    ${HeaderRoot}/client-glue:

vpath %.cpp \
    ${SourceRoot}/XMPCore: \
    ${SourceRoot}/common: \
    ${HeaderRoot}: \
    ${HeaderRoot}/client-glue: \
    ${ExpatRoot}/lib: \
    ${MD5Root}:

vpath %.c \
    ${SourceRoot}/XMPCore: \
    ${HeaderRoot}: \
    ${HeaderRoot}/client-glue: \
    ${ExpatRoot}/lib:

CPPSources =  \
    XMPMeta.cpp \
    XMPMeta-GetSet.cpp \
    XMPMeta-Parse.cpp \
    XMPMeta-Serialize.cpp \
    XMPIterator.cpp \
    XMPUtils.cpp \
    XMPUtils-FileInfo.cpp \
    XMPCore_Impl.cpp \
    ExpatAdapter.cpp \
    ParseRDF.cpp \
    UnicodeConversions.cpp \
    MD5.cpp \
    WXMPMeta.cpp \
    WXMPIterator.cpp \
    WXMPUtils.cpp \
    XML_Node.cpp

CCSources = \
    xmlparse.c \
    xmlrole.c \
    xmltok.c

Includes = \
   -I${HeaderRoot} \
   -I${SourceRoot}/XMPCore \
   -I${SourceRoot}/common \
   -I${BuildRoot}/build \
   -I${BuildRoot}/build/gcc3.2/${TargetOS} \
   -I${ExpatRoot}/lib \
   -I${MD5Root}

.SUFFIXES:                # Delete the default suffixes
.SUFFIXES: .o .c .cpp     # Define our suffix list

# ==================================================================================================

${TempRoot}/%.o : %.c
	@echo ""
	@echo "Compiling $<"
	${CC} ${CPPFLAGS} ${Includes} -c $< -o $@

${TempRoot}/%.o : %.cpp
	@echo ""
	@echo "Compiling $<"
	${CPP} ${CPPFLAGS} ${Includes} -c $< -o $@

# ==================================================================================================

.PHONY: all msg create_dirs

all : msg create_dirs ${LibName}

msg :
ifeq "${Error}" ""
	@echo ""
	@echo Building XMP toolkit for ${TargetOS} ${TargetStage}
else
	@echo ""
	@echo "Error: ${Error}"
	@echo ""
	@echo "# To build the XMP Toolkit :"
	@echo "#   make -f XMPCore.mak [OS=<os>] [STAGE=<stage>]"
	@echo "# where"
	@echo "#   OS    = i80386linux | sparcsolaris"
	@echo "#   STAGE = debug | release"
	@echo "#"
	@echo "# The OS and STAGE symbols can also be lowercase, os and stage."
	@echo "# This makefile is only for Linux and Solaris, AIX and HPUX do"
	@echo "# not use gcc, their makefiles are in other build folders. If" 
	@echo "# the OS is omitted it will try to default from the OSTYPE and"
	@echo "# MACHTYPE environment variables. If the stage is omitted it"
	@echo "# defaults to debug."
	@echo ""
	exit 1
endif

create_dirs :
	mkdir -p ${TempRoot}
	mkdir -p ${TargetRoot}

${LibName} : ${CCObjs} ${CPPObjs}
	@echo ""
	@echo "Linking $@"
	rm -f $@
	${AR}  $@ $?
	@echo ""

clean : msg
	rm -f ${TempRoot}/* ${TargetRoot}/*