7128320: Fix freetype sanity check to make it more generic
Reviewed-by: luchsh, katleman
Contributed-by: Jonathan Lu <luchsh@linux.vnet.ibm.com>
diff --git a/make/common/Defs-linux.gmk b/make/common/Defs-linux.gmk
index d20efc9..026b180 100644
--- a/make/common/Defs-linux.gmk
+++ b/make/common/Defs-linux.gmk
@@ -72,7 +72,6 @@
 SCRIPT_SUFFIX =
 # CC compiler object code output directive flag value
 CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
-CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
 
 # Default OBJCOPY comes from GNU Binutils on Linux:
 DEF_OBJCOPY=/usr/bin/objcopy
diff --git a/make/common/Defs-solaris.gmk b/make/common/Defs-solaris.gmk
index 666cdc1..aae6929 100644
--- a/make/common/Defs-solaris.gmk
+++ b/make/common/Defs-solaris.gmk
@@ -72,7 +72,6 @@
 SCRIPT_SUFFIX =
 # CC compiler object code output directive flag value
 CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
-CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
 
 ifdef ENABLE_FULL_DEBUG_SYMBOLS
 # Only check for Full Debug Symbols support on Solaris if it is
diff --git a/make/common/Defs-windows.gmk b/make/common/Defs-windows.gmk
index d04d60a..c23d024 100644
--- a/make/common/Defs-windows.gmk
+++ b/make/common/Defs-windows.gmk
@@ -36,7 +36,6 @@
 
 # CC compiler object code output directive flag value
 CC_OBJECT_OUTPUT_FLAG = -Fo
-CC_PROGRAM_OUTPUT_FLAG = -Fe
 
 # The suffix applied to the library name for FDLIBM
 FDDLIBM_SUFFIX = lib
diff --git a/make/common/Demo.gmk b/make/common/Demo.gmk
index 429c4e5..c6cf41d 100644
--- a/make/common/Demo.gmk
+++ b/make/common/Demo.gmk
@@ -319,9 +319,12 @@
 	@$(prep-target)
   ifeq ($(PLATFORM),windows)
 	$(RC) $(RC_FLAGS) $(CC_OBJECT_OUTPUT_FLAG)$(DEMO_VERSION_INFO) $(VERSIONINFO_RESOURCE)
-  endif
-	$(LINK.demo) $(SHARED_LIBRARY_FLAG) $(CC_PROGRAM_OUTPUT_FLAG)$@ \
+	$(LINK.demo) $(SHARED_LIBRARY_FLAG) -Fe$@ \
 	    $(DEMO_FULL_OBJECTS) $(LDLIBS.demo)
+  else
+	$(LINK.demo) $(SHARED_LIBRARY_FLAG) -o $@ \
+	    $(DEMO_FULL_OBJECTS) $(LDLIBS.demo)
+  endif
 	@$(call binary_file_verification,$@)
 
   # Generation of any javah include file, make sure objects are dependent on it
diff --git a/make/tools/freetypecheck/Makefile b/make/tools/freetypecheck/Makefile
index dcacde5..101542f 100644
--- a/make/tools/freetypecheck/Makefile
+++ b/make/tools/freetypecheck/Makefile
@@ -40,18 +40,19 @@
   FT_OPTIONS  = /nologo /c
   FREETYPE_DLL = $(FREETYPE_LIB_PATH)/freetype.dll
   FT_LD_OPTIONS  = $(FREETYPE_LIB_PATH)/freetype.lib
-ifdef MT
-  FT_LD_OPTIONS += /manifest
-endif
+  ifdef MT
+    FT_LD_OPTIONS += /manifest
+  endif
 else
   FT_OPTIONS  = $(CFLAGS)
   FT_LD_OPTIONS = -L$(FREETYPE_LIB_PATH)
   # Add runtime lib search path to ensure test will be runnable
-  ifeq ($(PLATFORM), solaris)
-    FT_LD_OPTIONS += -R $(FREETYPE_LIB_PATH) -lfreetype
-  else #linux
-      FT_LD_OPTIONS += -Wl,-rpath -Wl,$(FREETYPE_LIB_PATH) -lfreetype
+  ifeq ($(PLATFORM), linux)
+    FT_LD_OPTIONS += -Wl,-rpath -Wl,$(FREETYPE_LIB_PATH)
+  else # other unix
+    FT_LD_OPTIONS += -R $(FREETYPE_LIB_PATH)
   endif
+  FT_LD_OPTIONS += -lfreetype
 endif
 FT_OPTIONS += -I$(FREETYPE_HEADERS_PATH)
 FT_OPTIONS += -I$(FREETYPE_HEADERS_PATH)/freetype2
@@ -70,12 +71,12 @@
 	$(CC) $(FT_OPTIONS) $(CC_OBJECT_OUTPUT_FLAG)$(FT_OBJ) $<
 	$(LINK) $(FT_LD_OPTIONS) /OUT:$(FT_TEST) $(FT_OBJ)
 	$(CP) $(FREETYPE_DLL) $(@D)/
-ifdef MT
+  ifdef MT
 	$(CP) $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(@D)/
 	$(MT) /manifest $(FT_TEST).manifest /outputresource:$(FT_TEST);#1
-endif
+  endif
 else
-	@$(CC) $(FT_OPTIONS) $(CC_PROGRAM_OUTPUT_FLAG)$@ $< $(FT_LD_OPTIONS)
+	@$(CC) $(FT_OPTIONS) -o $@ $< $(FT_LD_OPTIONS)
 endif
 
 else