Makefile.aarch64 revision 10185
110185Seric.vanhensbergen@arm.com# Copyright (c) 2010 ARM Limited
210185Seric.vanhensbergen@arm.com# All rights reserved.
310185Seric.vanhensbergen@arm.com#
410185Seric.vanhensbergen@arm.com# The license below extends only to copyright in the software and shall
510185Seric.vanhensbergen@arm.com# not be construed as granting a license to any other intellectual
610185Seric.vanhensbergen@arm.com# property including but not limited to intellectual property relating
710185Seric.vanhensbergen@arm.com# to a hardware implementation of the functionality of the software
810185Seric.vanhensbergen@arm.com# licensed hereunder.  You may use the software subject to the license
910185Seric.vanhensbergen@arm.com# terms below provided that you ensure that this notice is replicated
1010185Seric.vanhensbergen@arm.com# unmodified and in its entirety in all distributions of the software,
1110185Seric.vanhensbergen@arm.com# modified or unmodified, in source code or in binary form.
1210185Seric.vanhensbergen@arm.com#
1310185Seric.vanhensbergen@arm.com# Copyright (c) 2005-2006 The Regents of The University of Michigan
1410185Seric.vanhensbergen@arm.com# All rights reserved.
1510185Seric.vanhensbergen@arm.com#
1610185Seric.vanhensbergen@arm.com# Redistribution and use in source and binary forms, with or without
1710185Seric.vanhensbergen@arm.com# modification, are permitted provided that the following conditions are
1810185Seric.vanhensbergen@arm.com# met: redistributions of source code must retain the above copyright
1910185Seric.vanhensbergen@arm.com# notice, this list of conditions and the following disclaimer;
2010185Seric.vanhensbergen@arm.com# redistributions in binary form must reproduce the above copyright
2110185Seric.vanhensbergen@arm.com# notice, this list of conditions and the following disclaimer in the
2210185Seric.vanhensbergen@arm.com# documentation and/or other materials provided with the distribution;
2310185Seric.vanhensbergen@arm.com# neither the name of the copyright holders nor the names of its
2410185Seric.vanhensbergen@arm.com# contributors may be used to endorse or promote products derived from
2510185Seric.vanhensbergen@arm.com# this software without specific prior written permission.
2610185Seric.vanhensbergen@arm.com#
2710185Seric.vanhensbergen@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2810185Seric.vanhensbergen@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2910185Seric.vanhensbergen@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3010185Seric.vanhensbergen@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3110185Seric.vanhensbergen@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3210185Seric.vanhensbergen@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3310185Seric.vanhensbergen@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3410185Seric.vanhensbergen@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3510185Seric.vanhensbergen@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3610185Seric.vanhensbergen@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3710185Seric.vanhensbergen@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3810185Seric.vanhensbergen@arm.com#
3910185Seric.vanhensbergen@arm.com# Authors: Nathan Binkert
4010185Seric.vanhensbergen@arm.com#          Ali Saidi
4110185Seric.vanhensbergen@arm.com
4210185Seric.vanhensbergen@arm.com### If we are not compiling on an arm v8, we must use cross tools ###
4310185Seric.vanhensbergen@arm.comifneq ($(shell uname -m), aarch64)
4410185Seric.vanhensbergen@arm.comCROSS_COMPILE?=aarch64-linux-gnu-
4510185Seric.vanhensbergen@arm.comendif
4610185Seric.vanhensbergen@arm.comCC=$(CROSS_COMPILE)gcc
4710185Seric.vanhensbergen@arm.comAS=$(CROSS_COMPILE)as
4810185Seric.vanhensbergen@arm.comLD=$(CROSS_COMPILE)ld
4910185Seric.vanhensbergen@arm.comAR=$(CROSS_COMPILE)ar
5010185Seric.vanhensbergen@arm.com
5110185Seric.vanhensbergen@arm.comJC=javac
5210185Seric.vanhensbergen@arm.comJH=javah
5310185Seric.vanhensbergen@arm.comJR=jar
5410185Seric.vanhensbergen@arm.com### JDK_PATH must be set to build gem5OpJni
5510185Seric.vanhensbergen@arm.com#JDK_PATH=/path/to/jdk/version_number
5610185Seric.vanhensbergen@arm.com
5710185Seric.vanhensbergen@arm.comCFLAGS=-O2 -I $(JDK_PATH)/include/ -I $(JDK_PATH)/include/linux -march=armv8-a
5810185Seric.vanhensbergen@arm.comLDFLAGS=-static -L. -lm5
5910185Seric.vanhensbergen@arm.com
6010185Seric.vanhensbergen@arm.comLIB_OBJS=m5op_arm_A64.o
6110185Seric.vanhensbergen@arm.comOBJS=m5.o
6210185Seric.vanhensbergen@arm.comJNI_OBJS=m5op_arm_A64.o jni_gem5Op.o
6310185Seric.vanhensbergen@arm.com
6410185Seric.vanhensbergen@arm.comall: libm5.a m5
6510185Seric.vanhensbergen@arm.com
6610185Seric.vanhensbergen@arm.com%.o: %.S
6710185Seric.vanhensbergen@arm.com	$(CC) $(CFLAGS) -o $@ -c $<
6810185Seric.vanhensbergen@arm.com
6910185Seric.vanhensbergen@arm.com%.o: %.c
7010185Seric.vanhensbergen@arm.com	$(CC)  $(CFLAGS) -o $@ -c $<
7110185Seric.vanhensbergen@arm.com
7210185Seric.vanhensbergen@arm.comm5: $(OBJS) libm5.a
7310185Seric.vanhensbergen@arm.com	$(CC) -o $@ $(OBJS) $(LDFLAGS)
7410185Seric.vanhensbergen@arm.com
7510185Seric.vanhensbergen@arm.comlibm5.a: $(LIB_OBJS)
7610185Seric.vanhensbergen@arm.com	$(AR) rcs $@ $<
7710185Seric.vanhensbergen@arm.com
7810185Seric.vanhensbergen@arm.comgem5OpJni: gem5OpJni.jar $(JNI_OBJS)
7910185Seric.vanhensbergen@arm.com	$(CC) --shared -o lib$@.so $(JNI_OBJS)
8010185Seric.vanhensbergen@arm.com
8110185Seric.vanhensbergen@arm.comgem5OpJni.jar:
8210185Seric.vanhensbergen@arm.com	$(JC) jni/gem5Op.java; \
8310185Seric.vanhensbergen@arm.com	$(JH) jni.gem5Op; \
8410185Seric.vanhensbergen@arm.com	$(JR) cvf $@ jni/*.class
8510185Seric.vanhensbergen@arm.com
8610185Seric.vanhensbergen@arm.comclean:
8710185Seric.vanhensbergen@arm.com	rm -f *.o m5 libgemOpJni.so gem5OpJni.jar jni/*.class libm5.a
88