Makefile.aarch64 revision 12157
14202Sbinkertn@umich.edu# Copyright (c) 2010 ARM Limited
24202Sbinkertn@umich.edu# All rights reserved.
34202Sbinkertn@umich.edu#
44202Sbinkertn@umich.edu# The license below extends only to copyright in the software and shall
54202Sbinkertn@umich.edu# not be construed as granting a license to any other intellectual
64202Sbinkertn@umich.edu# property including but not limited to intellectual property relating
74202Sbinkertn@umich.edu# to a hardware implementation of the functionality of the software
84202Sbinkertn@umich.edu# licensed hereunder.  You may use the software subject to the license
94202Sbinkertn@umich.edu# terms below provided that you ensure that this notice is replicated
104202Sbinkertn@umich.edu# unmodified and in its entirety in all distributions of the software,
114202Sbinkertn@umich.edu# modified or unmodified, in source code or in binary form.
124202Sbinkertn@umich.edu#
134202Sbinkertn@umich.edu# Copyright (c) 2005-2006 The Regents of The University of Michigan
144202Sbinkertn@umich.edu# All rights reserved.
154202Sbinkertn@umich.edu#
164202Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without
174202Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are
184202Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright
194202Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer;
204202Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright
214202Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the
224202Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution;
234202Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its
244202Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from
254202Sbinkertn@umich.edu# this software without specific prior written permission.
264202Sbinkertn@umich.edu#
274202Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
284202Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
294202Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
304202Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
314202Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
324202Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
335628Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
344486Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
354776Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
364486Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
378774Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
384202Sbinkertn@umich.edu#
394202Sbinkertn@umich.edu# Authors: Nathan Binkert
404202Sbinkertn@umich.edu#          Ali Saidi
414202Sbinkertn@umich.edu
425522Snate@binkert.org### If we are not compiling on an arm v8, we must use cross tools ###
438233Snate@binkert.orgifneq ($(shell uname -m), aarch64)
444202Sbinkertn@umich.eduCROSS_COMPILE?=aarch64-linux-gnu-
454202Sbinkertn@umich.eduendif
464202Sbinkertn@umich.eduCC=$(CROSS_COMPILE)gcc
474202Sbinkertn@umich.eduAS=$(CROSS_COMPILE)as
484202Sbinkertn@umich.eduLD=$(CROSS_COMPILE)ld
494202Sbinkertn@umich.eduAR=$(CROSS_COMPILE)ar
508770Sgblack@eecs.umich.edu
517768SAli.Saidi@ARM.comJC=javac
527768SAli.Saidi@ARM.comJH=javah
538766Sgblack@eecs.umich.eduJR=jar
547768SAli.Saidi@ARM.com### JDK_PATH must be set to build gem5OpJni
557768SAli.Saidi@ARM.com#JDK_PATH=/path/to/jdk/version_number
568766Sgblack@eecs.umich.edu
577768SAli.Saidi@ARM.comCFLAGS=-O2 -I $(JDK_PATH)/include/ -I $(JDK_PATH)/include/linux \
587768SAli.Saidi@ARM.com       -I$(PWD)/../../include -march=armv8-a
594202Sbinkertn@umich.eduLDFLAGS=-static -L. -lm5
608784Sgblack@eecs.umich.edu
615016Sgblack@eecs.umich.eduLIB_OBJS=m5op_arm_A64.o
624486Sbinkertn@umich.eduOBJS=m5.o
638335Snate@binkert.orgJNI_OBJS=m5op_arm_A64.o jni_gem5Op.o
648335Snate@binkert.org
659152Satgutier@umich.eduall: libm5.a m5
668335Snate@binkert.org
678335Snate@binkert.org%.o: %.S
688335Snate@binkert.org	$(CC) $(CFLAGS) -o $@ -c $<
698335Snate@binkert.org
708335Snate@binkert.org%.o: %.c
718335Snate@binkert.org	$(CC)  $(CFLAGS) -o $@ -c $<
728335Snate@binkert.org
738335Snate@binkert.orgm5: $(OBJS) libm5.a
748335Snate@binkert.org	$(CC) -o $@ $(OBJS) $(LDFLAGS)
758335Snate@binkert.org
768335Snate@binkert.orglibm5.a: $(LIB_OBJS)
778335Snate@binkert.org	$(AR) rcs $@ $<
788335Snate@binkert.org
798335Snate@binkert.orggem5OpJni: gem5OpJni.jar $(JNI_OBJS)
808335Snate@binkert.org	$(CC) --shared -o lib$@.so $(JNI_OBJS)
81
82gem5OpJni.jar:
83	$(JC) jni/gem5Op.java; \
84	$(JH) jni.gem5Op; \
85	$(JR) cvf $@ jni/*.class
86
87clean:
88	rm -f *.o m5 libgemOpJni.so gem5OpJni.jar jni/*.class libm5.a
89