# Gerons
# Copyright (C) 2008 HIMACS, Ltd.
# http://www.himacs.jp/
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Makefile

SUBARCH := uname -m | sed -e s/i.86/i686/

ARCH := m32

all : libGerons.so libGerons_r.so gdump sample sample_r

gerons_common.o : gerons_common.c gerons_core.h
	cc -g -$(ARCH) -fPIC -c gerons_common.c

libGerons_r.so : gerons_core.c gerons_common.o
	cc -g -$(ARCH) -fPIC -c gerons_core.c -D_THRED_SAFE
	cc -o ../libGerons_r.so -$(ARCH) -shared -fPIC gerons_core.o gerons_common.o -lpthread -Xlinker -init -Xlinker _init_debug

libGerons.so : gerons_core.c gerons_common.o
	cc -g -$(ARCH) -fPIC -c gerons_core.c
	cc -o ../libGerons.so -$(ARCH) -shared -fPIC gerons_core.o gerons_common.o -Xlinker -init -Xlinker _init_debug

gdump: gdump.o gerons_common.o
	cc -$(ARCH) -g -o ../gdump gdump.c gerons_common.o

sample: sample.c
	cc -$(ARCH) -g -o ../sample -rdynamic sample.c

sample_r: sample_r.c
	cc -$(ARCH) -g -o ../sample_r -rdynamic -D_THREAD_SAFE sample_r.c -lpthread

clean:
	rm *.o ../libGerons_r.so ../libGerons.so ../gdump ../sample ../sample_r
