Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/demo/jvmti/heapViewer/sample.makefile.txt
38827 views
#1# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.2#3# Redistribution and use in source and binary forms, with or without4# modification, are permitted provided that the following conditions5# are met:6#7# - Redistributions of source code must retain the above copyright8# notice, this list of conditions and the following disclaimer.9#10# - Redistributions in binary form must reproduce the above copyright11# notice, this list of conditions and the following disclaimer in the12# documentation and/or other materials provided with the distribution.13#14# - Neither the name of Oracle nor the names of its15# contributors may be used to endorse or promote products derived16# from this software without specific prior written permission.17#18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS19# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR22# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,23# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,24# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR25# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF26# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING27# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS28# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.29#3031########################################################################32#33# Sample GNU Makefile for building JVMTI Demo heapViewer34#35# Example uses:36# gnumake JDK=<java_home> OSNAME=solaris [OPT=true] [LIBARCH=sparc]37# gnumake JDK=<java_home> OSNAME=solaris [OPT=true] [LIBARCH=sparcv9]38# gnumake JDK=<java_home> OSNAME=linux [OPT=true]39# gnumake JDK=<java_home> OSNAME=win32 [OPT=true]40#41########################################################################4243# Source lists44LIBNAME=heapViewer45SOURCES=heapViewer.c ../agent_util/agent_util.c4647# Solaris Sun C Compiler Version 5.548ifeq ($(OSNAME), solaris)49# Sun Solaris Compiler options needed50COMMON_FLAGS=-mt -KPIC51# Options that help find errors52COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none53# Check LIBARCH for any special compiler options54LIBARCH=$(shell uname -p)55ifeq ($(LIBARCH), sparc)56COMMON_FLAGS+=-xarch=v8 -xregs=no%appl57endif58ifeq ($(LIBARCH), sparcv9)59COMMON_FLAGS+=-xarch=v9 -xregs=no%appl60endif61ifeq ($(OPT), true)62CFLAGS=-xO2 $(COMMON_FLAGS)63else64CFLAGS=-g $(COMMON_FLAGS)65endif66# Object files needed to create library67OBJECTS=$(SOURCES:%.c=%.o)68# Library name and options needed to build it69LIBRARY=lib$(LIBNAME).so70LDFLAGS=-z defs -ztext71# Libraries we are dependent on72LIBRARIES= -lc73# Building a shared library74LINK_SHARED=$(LINK.c) -G -o $@75endif7677# Linux GNU C Compiler78ifeq ($(OSNAME), linux)79# GNU Compiler options needed to build it80COMMON_FLAGS=-fno-strict-aliasing -fPIC -fno-omit-frame-pointer81# Options that help find errors82COMMON_FLAGS+= -W -Wall -Wno-unused -Wno-parentheses83ifeq ($(OPT), true)84CFLAGS=-O2 $(COMMON_FLAGS)85else86CFLAGS=-g $(COMMON_FLAGS)87endif88# Object files needed to create library89OBJECTS=$(SOURCES:%.c=%.o)90# Library name and options needed to build it91LIBRARY=lib$(LIBNAME).so92LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc93# Libraries we are dependent on94LIBRARIES=-lc95# Building a shared library96LINK_SHARED=$(LINK.c) -shared -o $@97endif9899# Windows Microsoft C/C++ Optimizing Compiler Version 12100ifeq ($(OSNAME), win32)101CC=cl102# Compiler options needed to build it103COMMON_FLAGS=-Gy -DWIN32104# Options that help find errors105COMMON_FLAGS+=-W0 -WX106ifeq ($(OPT), true)107CFLAGS= -Ox -Op -Zi $(COMMON_FLAGS)108else109CFLAGS= -Od -Zi $(COMMON_FLAGS)110endif111# Object files needed to create library112OBJECTS=$(SOURCES:%.c=%.obj)113# Library name and options needed to build it114LIBRARY=$(LIBNAME).dll115LDFLAGS=116# Libraries we are dependent on117LIBRARIES=118# Building a shared library119LINK_SHARED=link -dll -out:$@120endif121122# Common -I options123CFLAGS += -I.124CFLAGS += -I$(JDK)/include -I$(JDK)/include/$(OSNAME)125126# Default rule127all: $(LIBRARY)128129# Build native library130$(LIBRARY): $(OBJECTS)131$(LINK_SHARED) $(OBJECTS) $(LIBRARIES)132133# Cleanup the built bits134clean:135rm -f $(LIBRARY) $(OBJECTS)136137# Simple tester138test: all139LD_LIBRARY_PATH=`pwd` $(JDK)/bin/java -agentlib:$(LIBNAME) -version140141# Compilation rule only needed on Windows142ifeq ($(OSNAME), win32)143%.obj: %.c144$(COMPILE.c) $<145endif146147148149