Makefile.arm revision 9821
17732SAli.Saidi@ARM.com# Copyright (c) 2010 ARM Limited
27732SAli.Saidi@ARM.com# All rights reserved.
37732SAli.Saidi@ARM.com#
47732SAli.Saidi@ARM.com# The license below extends only to copyright in the software and shall
57732SAli.Saidi@ARM.com# not be construed as granting a license to any other intellectual
67732SAli.Saidi@ARM.com# property including but not limited to intellectual property relating
77732SAli.Saidi@ARM.com# to a hardware implementation of the functionality of the software
87732SAli.Saidi@ARM.com# licensed hereunder.  You may use the software subject to the license
97732SAli.Saidi@ARM.com# terms below provided that you ensure that this notice is replicated
107732SAli.Saidi@ARM.com# unmodified and in its entirety in all distributions of the software,
117732SAli.Saidi@ARM.com# modified or unmodified, in source code or in binary form.
127732SAli.Saidi@ARM.com#
137732SAli.Saidi@ARM.com# Copyright (c) 2005-2006 The Regents of The University of Michigan
147732SAli.Saidi@ARM.com# All rights reserved.
157732SAli.Saidi@ARM.com#
167732SAli.Saidi@ARM.com# Redistribution and use in source and binary forms, with or without
177732SAli.Saidi@ARM.com# modification, are permitted provided that the following conditions are
187732SAli.Saidi@ARM.com# met: redistributions of source code must retain the above copyright
197732SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer;
207732SAli.Saidi@ARM.com# redistributions in binary form must reproduce the above copyright
217732SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer in the
227732SAli.Saidi@ARM.com# documentation and/or other materials provided with the distribution;
237732SAli.Saidi@ARM.com# neither the name of the copyright holders nor the names of its
247732SAli.Saidi@ARM.com# contributors may be used to endorse or promote products derived from
257732SAli.Saidi@ARM.com# this software without specific prior written permission.
267732SAli.Saidi@ARM.com#
277732SAli.Saidi@ARM.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
287732SAli.Saidi@ARM.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
297732SAli.Saidi@ARM.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
307732SAli.Saidi@ARM.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
317732SAli.Saidi@ARM.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
327732SAli.Saidi@ARM.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
337732SAli.Saidi@ARM.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
347732SAli.Saidi@ARM.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
357732SAli.Saidi@ARM.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
367732SAli.Saidi@ARM.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
377732SAli.Saidi@ARM.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
387732SAli.Saidi@ARM.com#
397732SAli.Saidi@ARM.com# Authors: Nathan Binkert
407732SAli.Saidi@ARM.com#          Ali Saidi
417732SAli.Saidi@ARM.com
429821Satgutier@umich.edu### If we are not compiling on an arm, we must use cross tools ###
439192SAli.Saidi@ARM.comifneq ($(shell uname -m), armv7l)
449192SAli.Saidi@ARM.comCROSS_COMPILE?=arm-linux-gnueabi-
457732SAli.Saidi@ARM.comendif
467732SAli.Saidi@ARM.comCC=$(CROSS_COMPILE)gcc
477732SAli.Saidi@ARM.comAS=$(CROSS_COMPILE)as
487732SAli.Saidi@ARM.comLD=$(CROSS_COMPILE)ld
499333Sjames.clarkson@arm.comAR=$(CROSS_COMPILE)ar
507732SAli.Saidi@ARM.com
518547Sprakash.ramrakhyani@arm.comJC=javac
528547Sprakash.ramrakhyani@arm.comJH=javah
538547Sprakash.ramrakhyani@arm.comJR=jar
548547Sprakash.ramrakhyani@arm.com### JDK_PATH must be set to build gem5OpJni
558547Sprakash.ramrakhyani@arm.com#JDK_PATH=/path/to/jdk/version_number
568547Sprakash.ramrakhyani@arm.com
579821Satgutier@umich.eduCFLAGS=-O2 -I $(JDK_PATH)/include/ -I $(JDK_PATH)/include/linux -march=armv7-a
589333Sjames.clarkson@arm.comLDFLAGS=-L. -lm5
598547Sprakash.ramrakhyani@arm.com
609333Sjames.clarkson@arm.comLIB_OBJS=m5op_arm.o
619333Sjames.clarkson@arm.comOBJS=m5.o
628547Sprakash.ramrakhyani@arm.comJNI_OBJS=m5op_arm.o jni_gem5Op.o
637732SAli.Saidi@ARM.com
649333Sjames.clarkson@arm.comall: libm5.a m5
657732SAli.Saidi@ARM.com
667732SAli.Saidi@ARM.com%.o: %.S
677732SAli.Saidi@ARM.com	$(CC) $(CFLAGS) -o $@ -c $<
687732SAli.Saidi@ARM.com
697732SAli.Saidi@ARM.com%.o: %.c
707732SAli.Saidi@ARM.com	$(CC)  $(CFLAGS) -o $@ -c $<
717732SAli.Saidi@ARM.com
729685Sandreas@sandberg.pp.sem5: $(OBJS) libm5.a
739333Sjames.clarkson@arm.com	$(CC) -o $@ $(OBJS) $(LDFLAGS)
749333Sjames.clarkson@arm.com
759333Sjames.clarkson@arm.comlibm5.a: $(LIB_OBJS)
769333Sjames.clarkson@arm.com	$(AR) rcs $@ $<
777732SAli.Saidi@ARM.com
788547Sprakash.ramrakhyani@arm.comgem5OpJni: gem5OpJni.jar $(JNI_OBJS)
798547Sprakash.ramrakhyani@arm.com	$(CC) --shared -o lib$@.so $(JNI_OBJS)
808547Sprakash.ramrakhyani@arm.com
818547Sprakash.ramrakhyani@arm.comgem5OpJni.jar:
828547Sprakash.ramrakhyani@arm.com	$(JC) jni/gem5Op.java; \
838547Sprakash.ramrakhyani@arm.com	$(JH) jni.gem5Op; \
848547Sprakash.ramrakhyani@arm.com	$(JR) cvf $@ jni/*.class
858547Sprakash.ramrakhyani@arm.com
867732SAli.Saidi@ARM.comclean:
879333Sjames.clarkson@arm.com	rm -f *.o m5 libgemOpJni.so gem5OpJni.jar jni/*.class libm5.a
88