Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/demo/jvmti/waiters/sample.makefile.txt
38829 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 waiters34#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=waiters45SOURCES=waiters.cpp Agent.cpp Thread.cpp Monitor.cpp ../agent_util/agent_util.c4647# Solaris Sun C Compiler Version 5.548ifeq ($(OSNAME), solaris)49# Tell gnumake which compilers to use50CC=cc51CXX=CC52# Sun Solaris Compiler options needed53COMMON_FLAGS=-mt -KPIC54# Check LIBARCH for any special compiler options55LIBARCH=$(shell uname -p)56ifeq ($(LIBARCH), sparc)57COMMON_FLAGS+=-xarch=v8 -xregs=no%appl58endif59ifeq ($(LIBARCH), sparcv9)60COMMON_FLAGS+=-xarch=v9 -xregs=no%appl61endif62ifeq ($(OPT), true)63CXXFLAGS=-xO2 $(COMMON_FLAGS)64else65CXXFLAGS=-g $(COMMON_FLAGS)66endif67# Object files needed to create library68OBJECTS=$(SOURCES:%.cpp=%.o)69# Library name and options needed to build it70LIBRARY=lib$(LIBNAME).so71LDFLAGS=-z defs -ztext72# Libraries we are dependent on73LIBRARIES= -lc74# Building a shared library75LINK_SHARED=$(LINK.cc) -G -o $@76endif7778# Linux GNU C Compiler79ifeq ($(OSNAME), linux)80# GNU Compiler options needed to build it81COMMON_FLAGS=-fno-strict-aliasing -fPIC -fno-omit-frame-pointer82# Options that help find errors83COMMON_FLAGS+= -W -Wall -Wno-unused -Wno-parentheses84ifeq ($(OPT), true)85CXXFLAGS=-O2 $(COMMON_FLAGS)86else87CXXFLAGS=-g $(COMMON_FLAGS)88endif89# Object files needed to create library90OBJECTS=$(SOURCES:%.cpp=%.o)91# Library name and options needed to build it92LIBRARY=lib$(LIBNAME).so93LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc94# Libraries we are dependent on95LIBRARIES=96# Building a shared library97LINK_SHARED=$(LINK.cc) -shared -o $@98endif99100# Windows Microsoft C/C++ Optimizing Compiler Version 12101ifeq ($(OSNAME), win32)102CC=cl103# Compiler options needed to build it104COMMON_FLAGS=-Gy -DWIN32105# Options that help find errors106COMMON_FLAGS+=-W0 -WX107ifeq ($(OPT), true)108CXXFLAGS= -Ox -Op -Zi $(COMMON_FLAGS)109else110CXXFLAGS= -Od -Zi $(COMMON_FLAGS)111endif112# Object files needed to create library113OBJECTS=$(SOURCES:%.cpp=%.obj)114# Library name and options needed to build it115LIBRARY=$(LIBNAME).dll116LDFLAGS=117# Libraries we are dependent on118LIBRARIES=119# Building a shared library120LINK_SHARED=link -dll -out:$@121endif122123# Common -I options124CXXFLAGS += -I.125CXXFLAGS += -I../agent_util126CXXFLAGS += -I$(JDK)/include -I$(JDK)/include/$(OSNAME)127128# Default rule129all: $(LIBRARY)130131# Build native library132$(LIBRARY): $(OBJECTS)133$(LINK_SHARED) $(OBJECTS) $(LIBRARIES)134135# Cleanup the built bits136clean:137rm -f $(LIBRARY) $(OBJECTS)138139# Simple tester140test: all141LD_LIBRARY_PATH=`pwd` $(JDK)/bin/java -agentlib:$(LIBNAME) -version142143# Compilation rule only needed on Windows144ifeq ($(OSNAME), win32)145%.obj: %.cpp146$(COMPILE.cc) $<147endif148149150151