Skip to content

Commit

Permalink
Makefile cleanup, make common IS_CLEAN_GOAL and IS_TEST_GOAL variables.
Browse files Browse the repository at this point in the history
	Change on 2016/04/25 by kstanger <kstanger@google.com>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120725448
  • Loading branch information
kstanger authored and Keith Stanger committed Apr 28, 2016
1 parent 9c33a43 commit f62ce72
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ SUFFIXES:

default: dist

# Force test targets to be run sequentially to avoid interspersed output.
ifeq "$(findstring test,$(MAKECMDGOALS))" "test"
.NOTPARALLEL:
endif

J2OBJC_ROOT = .

include make/common.mk
include make/j2objc_deps.mk

# Force test targets to be run sequentially to avoid interspersed output.
ifdef IS_TEST_GOAL
.NOTPARALLEL:
endif

MAN_DIR = doc/man
MAN_PAGES = $(MAN_DIR)/j2objc.1 $(MAN_DIR)/j2objcc.1

Expand Down
2 changes: 1 addition & 1 deletion guava/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ default: dist
include environment.mk

JAVA_SOURCES_INCLUDE = $(BUILD_DIR)/java_sources.mk
ifneq ($(findstring clean,$(notdir $(MAKECMDGOALS))),clean)
ifndef IS_CLEAN_GOAL
-include $(JAVA_SOURCES_INCLUDE)
endif

Expand Down
7 changes: 7 additions & 0 deletions make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ STATIC_ANALYZER_FLAGS = \
-Xclang -analyzer-checker -Xclang security.insecureAPI.vfork \
--analyze

ifeq ($(findstring clean,$(notdir $(MAKECMDGOALS))),clean)
IS_CLEAN_GOAL = 1
endif
ifeq ($(findstring test,$(notdir $(MAKECMDGOALS))),test)
IS_TEST_GOAL = 1
endif

# Avoid bash 'arument list too long' errors.
# See http://stackoverflow.com/questions/512567/create-a-file-from-a-large-makefile-variable
# TODO(iroth): When make 3.82 is available, use the $(file ...) function instead.
Expand Down
4 changes: 2 additions & 2 deletions make/fat_lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ FAT_LIB_PLISTS = \
$(foreach src,$(FAT_LIB_SOURCES_RELATIVE),$(FAT_LIB_PLIST_DIR)/$(basename $(src)).plist)
FAT_LIB_OBJS = $(foreach file,$(FAT_LIB_SOURCES_RELATIVE),$(basename $(file)).o)

ifneq ($(MAKECMDGOALS),clean)
ifndef IS_CLEAN_GOAL

$(call emit_compile_rules,$(FAT_LIB_SOURCE_DIRS),$(FAT_LIB_COMPILE),$(FAT_LIB_PRECOMPILED_HEADER))

Expand All @@ -52,4 +52,4 @@ $(ARCH_LIB_DIR)/%.a: $(ARCH_BUILD_DIR)/%.a
analyze: $(FAT_LIB_PLISTS)
@:

endif # ifneq ($(MAKECMDGOALS),clean)
endif # ifndef IS_CLEAN_GOAL
2 changes: 1 addition & 1 deletion make/j2objc_protos.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Author: Keith Stanger

J2OBJC_PROTOS_GENERATED_FILES_INCLUDE = $(BUILD_DIR)/j2objc_protos_generated_files.mk
ifneq ($(findstring clean,$(notdir $(MAKECMDGOALS))),clean)
ifndef IS_CLEAN_GOAL
ifeq ($(wildcard $(J2OBJC_PROTOS_GENERATED_FILES_INCLUDE)),)
# Avoid a warning from the include directive that the file doesn't exist, then
# immediately delete the file so that make rebuilds it correctly.
Expand Down
2 changes: 1 addition & 1 deletion make/transitive_java_deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TRANSITIVE_JAVA_DEPS_ROOT_LIST = $(BUILD_DIR)/$(TRANSITIVE_JAVA_DEPS_NAME)_root_

TRANSITIVE_JAVA_DEPS_SOURCEPATH_LIST = $(subst :, ,$(TRANSITIVE_JAVA_DEPS_SOURCEPATH))

ifneq ($(findstring clean,$(notdir $(MAKECMDGOALS))),clean)
ifndef IS_CLEAN_GOAL
ifeq ($(wildcard $(TRANSITIVE_JAVA_DEPS_INCLUDE)),)
# Avoid a warning from the include directive that the file doesn't exist, then
# immediately delete the file so that make rebuilds it correctly.
Expand Down
2 changes: 1 addition & 1 deletion protobuf/runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ DIST_JAR = $(DIST_JAR_DIR)/protobuf_runtime.jar
OBJC_SOURCES_MANIFEST = $(BUILD_DIR)/objc_sources.mf

ifndef PROTOBUF_ROOT_DIR
ifneq "$(findstring clean,$(MAKECMDGOALS))" "clean"
ifndef IS_CLEAN_GOAL
$(error PROTOBUF_ROOT_DIR not defined)
endif
endif
Expand Down

0 comments on commit f62ce72

Please sign in to comment.