📄 midp.gmk
字号:
## Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved.# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER## This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License version# 2 only, as published by the Free Software Foundation.## This program is distributed in the hope that it will be useful, but# WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU# General Public License version 2 for more details (a copy is# included at /legal/license.txt).## You should have received a copy of the GNU General Public License# version 2 along with this work; if not, write to the Free Software# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA# 02110-1301 USA## Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa# Clara, CA 95054 or visit www.sun.com if you need additional# information or have any questions.######################################################################### Makefile for building the MID Profile. It should not contain any# targets for VM-specific tools.## Most frequently used targets:## all -- build optimized and debug versions of the core JDK.# midp -- build the midp executable######################################################################## Cancels implicit rules#include $(MIDP_DIR)/build/common/makefiles/CancelImplicits.gmk# Tool targets#include $(MIDP_DIR)/build/common/makefiles/Tools.gmk# Build system# We make the output directory as one of the vpaths# since generated code will go there.#vpath % $(MIDP_OUTPUT_DIR)# ================================================================# Pre-Java-Dependency-Search for classes.zip## Lists of Java files to be compiled. This rule must occur before any# other rule for classes.zip so that the message is emitted and the# list files are removed first. Evaulation of subsequent dependencies# will have the side effect of populating the list files.#$(MIDP_CLASSES_ZIP) :: @echo " ... searching updated .java files" $(LOG) $(remove_filelist) $(remove_genfilelist)# Additional configuration settings, by each subsystem#include $(MIDP_DIR)/build/common/makefiles/SubsystemDefs.gmk# I3 tests.## Run through the .class file list and apply pattern matching and# substitution to generate the list of i3 test classes. A class file# is considered to be a test case if its name begins with 'Test'# and isn't named 'TestCase'. Note that we are using the class file list# constructed from the java filenames, so we don't have to worry about# inner classes. If we were to search for classes, we'd have to filter# out classes whose names contain '$'.#ifeq ($(USE_I3_TEST), true)I3_TEMPNUM := $(shell echo $$$$)I3_TEMP1 = /tmp/midpi3testa$(I3_TEMPNUM)I3_TEMP2 = /tmp/midpi3testb$(I3_TEMPNUM)I3_TEST_REPOSITORY_DIR=$(GENERATED_DIR)/classes/com/sun/midp/i3testI3_TEST_REPOSITORY_FILE=Repository.javaI3_TEST_REPOSITORY=$(I3_TEST_REPOSITORY_DIR)/$(I3_TEST_REPOSITORY_FILE)$(MIDP_CLASSES_ZIP) :: $(JTWI_I3TEST_JAVA_FILES) @echo $? >> $(REBUILD_JAVA_LIST) @echo " ... generating I3 test repository " $(LOG) @mkdir -p $(I3_TEST_REPOSITORY_DIR) @echo $(JTWI_I3TEST_JAVA_FILES) | \ tr ' ' '\012' | \ grep 'i3test/.*/Test' | \ sed -e 's,/i3test/,/+++/,' -e 's,.*/+++/,,' | \ sed -e 's,\.java$$,,' -e 's,/,.,g' \ > $(I3_TEMP1) @( \ echo '// This file is generated by "MIDP.gmk". Do not edit.' ; \ echo 'package com.sun.midp.i3test;' ; \ echo 'class Repository {' ; \ echo ' static String testNames[] = {' ; \ sed -e 's,^, ",' \ -e 's/$$/",/' $(I3_TEMP1) ; \ echo ' };' ; \ echo '}' \ ) > $(I3_TEMP2) @if [ -f $(I3_TEST_REPOSITORY) ] && \ cmp -s $(I3_TEMP2) $(I3_TEST_REPOSITORY) ; then \ echo " ... no changes" ; \ else \ echo " ... found" `wc -l < $(I3_TEMP1)` "test cases" $(LOG) ; \ cp $(I3_TEMP2) $(I3_TEST_REPOSITORY) ; \ fi @rm -f $(I3_TEMP1) $(I3_TEMP2) @echo $(JTWI_I3TEST_JAVA_FILES) >> $(ALL_JAVA_LIST)$(MIDP_CLASSES_ZIP):: $(I3_TEST_REPOSITORY) @echo $(I3_TEST_REPOSITORY) >> $(GENERATED_JAVA_LIST)endififeq ($(USE_JUNIT_TEST), true)$(MIDP_JUNIT_CLASSES_ZIP): $(MIDP_CLASSES_ZIP) $(JTWI_JUNIT_JAVA_FILES)ifneq ($(strip $(JTWI_JUNIT_JAVA_FILES)),) @# TBD: better integration with the rest of the system, e.g. no check below + regenerate classes.zip when one of tests get rebuild @if [ '!' -d $(JAVAC_OUT_DIR) ]; then \ mkdir -p $(JAVAC_OUT_DIR); \ fi @$(JAVAC_CMD) -g$(JAVAC_DEBUG) -d $(JAVAC_OUT_DIR) \ -source 1.4 -target 1.4 \ -bootclasspath $(BOOTCLASSPATH) \ -classpath $(CLASSBINDIR)$(PATHSEP)$(JUNIT_JAR) $(JTWI_JUNIT_JAVA_FILES) @rm -f $@ @$(JAR_CMD) -cf $@ -C $(JAVAC_OUT_DIR) .endifendif# ================================================================# Post-Java-Dependency-Search for classes.zip# Creates classes.zip#$(MIDP_CLASSES_ZIP)::$(GENERATED_JAVA_FILES) \ $(PREVERIFY_CMD) \ $(CONFIGURATOR_JAR_FILE) \ $(UNCOMPRESSED_VM_CLASSES) \ FORCE @if [ '!' -d $(CLASSBINDIR) ]; then \ mkdir -p $(CLASSBINDIR); \ fi $(compilefiles) $(remove_filelist) $(remove_genfilelist) $(split_midpclasses_zip)try_build_classes:: $(MIDP_CLASSES_ZIP)build_classes: $(A)$(MAKE) try_build_classes# Main rule#ROM_DEPS += $(BINDIR) $(OBJ_DIR) jpp build_classesifeq ($(TARGET_VM), cldc_vm)ROM_DEPS += $(MIDP_OUTPUT_DIR)/ROMImage.cppelse# cdc_dummies is defined in cdc_vm.gmkROM_DEPS += cdc_dummies $(ROMSTRUCTS_H)endifrom: $(ROM_DEPS)ifneq ($(USE_JSR_234), true)ifneq ($(USE_JSR_135), true)ifneq ($(USE_MIDP_ABB), true)MMAPI_TARGET = mmapiendifendifendifMIDP_RESOURCES += ams_resourcesMIDP_DEPS += $(ROM_DEPS) $(MMAPI_TARGET) $(OBJ_FILES) $(KDP_CMD) \ all_tools not_yet_implementedifeq ($(ENABLE_MEMORY_PROFILER), true)MIDP_DEPS += $(MEMPROF_CMD)endifnot_yet_implemented::# If you're using a multi-CPU host, or if your MIDP_OUTPUT_DIR points# to a network filed system, use something like "make parallel NUM_JOBS=3".# That will speed up your build process.## Note that the "rom" target cannot be built in parallel (because the way# we generate the list of Java source file dependencies). Therefore, the# build will break if you just do a "make all -j 3".ifndef NUM_JOBSNUM_JOBS = 2endifparallel_all:: $(VERIFY_BUILD_ENV) $(DISPLAY_BUILD_ENV) rom @echo "Building in parallel mode with $(NUM_JOBS) jobs" @$(MAKE) -j $(NUM_JOBS) IN_PARALLEL_BUILD=true @echo "Finished building in parallel mode with $(NUM_JOBS) jobs"# If use static properties flag is false, we just merely# copy the config files with properties for dynamic usage.#ifeq ($(USE_STATIC_PROPERTIES), false)ifeq ($(USE_JAVACALL_PROPERTIES), true)MIDP_DEPS += $(BINDIR)/jwc_properties.ini$(BINDIR)/jwc_properties.ini: $(BINDIR) $(SUBSYSTEM_CONFIGURATION_CONFIG_FILES) if [ -f $@ ];then \ rm -f $@; \ fi $(LOG) -(cp $(GENERATED_DIR)/jwc_properties.ini $@) $(LOG) -(chmod +w $@) $(LOG)elseMIDP_DEPS += $(LIBDIR)/internal.config $(LIBDIR)/system.config$(LIBDIR)/internal.config $(LIBDIR)/system.config: $(LIBDIR) $(SUBSYSTEM_CONFIGURATION_CONFIG_FILES) if [ -f $@ ];then \ rm -f $@; \ fi $(LOG) -(cp $(GENERATED_DIR)/$(subst $(MIDP_OUTPUT_DIR),,$@) $@) $(LOG) -(chmod +w $@) $(LOG)endifendififeq ($(TARGET_VM), cdc_vm) ifneq ($(CVM_STATICLINK_LIBS), true) MIDP_DEPS += $(MIDP_SHARED_LIB) endifendif# All object files## Note: we need explicit rules for all generated C source files because they are# not detected by vpath.$(OBJ_DIR)/%.o: %.c @echo " ... $@" $(LOG) $(A)$(CC) $(CFLAGS) -c $(CC_OUTPUT)$@ `$(call fixcygpath, $<)` $(LOG)$(OBJ_DIR)/ROMImage.o: $(MIDP_OUTPUT_DIR)/ROMImage.cpp @echo " ... $@" $(LOG) $(A)$(CPP) $(CPPFLAGS) -c $(CC_OUTPUT)$@ `$(call fixcygpath, $<)` $(LOG)$(OBJ_DIR)/nativeFunctionTable.o: $(MIDP_OUTPUT_DIR)/nativeFunctionTable.cpp @echo " ... $@" $(LOG) $(A)$(CPP) $(CPPFLAGS) -c $(CC_OUTPUT)$@ `$(call fixcygpath, $<)` $(LOG)$(OBJ_DIR)/%.o: %.cpp @echo " ... $@" $(LOG) $(A)$(CPP) $(CPPFLAGS) -c $(CC_OUTPUT)$@ `$(call fixcygpath, $<)` $(LOG)$(MIDP_OUTPUT_DIR) $(OBJ_DIR) $(CLASSBINDIR) $(BINDIR) $(LIBDIR) $(VERIFYDIR) $(STORAGEDIR) $(EXTSTORAGEDIR) $(CLASSBINDIR)/icons $(CLASSBINDIR)/audio: @echo " ... creating directories $@ " $(LOG) $(A)mkdir -p $@ $(LOG)clean:: @if [ "$(MIDP_OUTPUT_DIR)" = "/" -o -d "$(MIDP_OUTPUT_DIR)/SCCS" ]; then \ echo "ERROR: Invalid MIDP_OUTPUT_DIR $(MIDP_OUTPUT_DIR)"; \ exit 1; \ else \ echo; \ echo " ... deleting directory $(MIDP_OUTPUT_DIR)"; \ sleep 3; \ rm -rf "$(MIDP_OUTPUT_DIR)"; \ fi $(LOG)ifneq ($(MIDP_LIB),)$(MIDP_LIB): $(MIDP_LIB_FILES) @echo " ... libing $@ " $(LOG) $(AR) $(LIB_OUTPUT)`$(call fixcygpath,$@ \ $(LD_START_GROUP) $(MIDP_LIB_FILES) $(LIBS))` $(LD_END_GROUP) $(LOG)ifeq ($(CREATE_MIDP_LIB),true)MIDP_DEPS += $(MIDP_LIB)endifendififneq ($(MIDP_SHARED_LIB),)$(MIDP_SHARED_LIB): $(MIDP_SHARED_LIB_FILES) @echo " ... linking $@ " $(LOG) $(AT)$(LD) $(LD_FLAGS) $(LINKER_OUTPUT)`$(call fixcygpath,$@ \ $(MIDP_SHARED_LIB_FILES) $(LIBS))` $(LOG) ifeq ($(CREATE_MIDP_SHARED_LIB),true)MIDP_DEPS += $(MIDP_SHARED_LIB)endifendifmidp: $(MIDP_DEPS) $(MIDP_RESOURCES)# Phonies to avoid accidents.#.PHONY: all midp clean run_configurator merge_configurations_uncond ams_resources rom FORCE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -