diff options
author | Dan McDonald <danmcd@joyent.com> | 2021-02-09 19:57:40 -0500 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2021-02-09 19:57:47 -0500 |
commit | cbc25ae7e56661048b2525598c793dd387ad85da (patch) | |
tree | 41ad86ba88a816a528b80270c7253e192dcc7b39 | |
parent | 83fbed6f664b5d3ca3e61c896d9b180b3cd06202 (diff) | |
parent | 44ce9f4b5e85893725f9e851530b585072ee8593 (diff) | |
download | illumos-joyent-cbc25ae7e56661048b2525598c793dd387ad85da.tar.gz |
[illumos-gate merge]
commit 44ce9f4b5e85893725f9e851530b585072ee8593
13492 Makefile.ast could avoid sed's -i option
Conflicts:
usr/src/cmd/ast/Makefile.ast
-rw-r--r-- | usr/src/cmd/ast/Makefile.ast | 17 | ||||
-rw-r--r-- | usr/src/cmd/ast/Makefile.iffe | 8 | ||||
-rw-r--r-- | usr/src/cmd/ast/libast/Makefile.com | 14 | ||||
-rw-r--r-- | usr/src/cmd/ast/libast/Makefile.iffe | 21 | ||||
-rw-r--r-- | usr/src/cmd/ast/libcmd/Makefile.com | 2 | ||||
-rw-r--r-- | usr/src/cmd/ast/libdll/Makefile.com | 2 | ||||
-rw-r--r-- | usr/src/cmd/ast/libsum/Makefile.com | 2 |
7 files changed, 44 insertions, 22 deletions
diff --git a/usr/src/cmd/ast/Makefile.ast b/usr/src/cmd/ast/Makefile.ast index 1b7b6f1572..0aeb13a09c 100644 --- a/usr/src/cmd/ast/Makefile.ast +++ b/usr/src/cmd/ast/Makefile.ast @@ -157,10 +157,19 @@ ASTCFLAGS64= $(CCVERBOSE) # # They have trailing whitespace, which is removed. -# XXX WORKAROUND - add "" to the -i because SmartOS backed out illumos#586 -POST_PROCESS_AST = $(SED) -i "" ' \ +# Unfortunately, due to differences in the "sed" command implemented in +# various illumos distributions, we can't portably use 'sed -i' here. + +SEDPATTERN= \ s^$(SRC)/^^g; \ s/ *$$//; \ /def.* _def_.*_$(MACH64)/s/$(MACH64)/$(HDRGUARD)/; \ - /def.* _def_.*_$(MACH)/s/$(MACH)/$(HDRGUARD)/; \ - ' + /def.* _def_.*_$(MACH)/s/$(MACH)/$(HDRGUARD)/; + +POST_PROCESS_AST= \ + { \ + tf=$$(mktemp /tmp/ast.XXXXXXXXXX) && \ + $(SED) < "$@" > "$$tf" '$(SEDPATTERN)' && \ + $(CP) -p "$$tf" "$@" && \ + $(RM) "$$tf"; \ + } diff --git a/usr/src/cmd/ast/Makefile.iffe b/usr/src/cmd/ast/Makefile.iffe index 07bd3ab5bf..d29d4cb44a 100644 --- a/usr/src/cmd/ast/Makefile.iffe +++ b/usr/src/cmd/ast/Makefile.iffe @@ -47,7 +47,7 @@ IFFECPPFLAGS= $(ASTPLATFORMCPPFLAGS) \ -I$(ASTSRC)/include -I. IFFECFLAGS= $(CSTD_GNU99) $($(TARGETMACH)_COPTFLAG) \ $($(TARGETMACH)_C_BIGPICFLAGS) $($(TARGETMACH)_CFLAGS) -IFFELDFLAGS= $(ZASSERTDEFLIB) $(ZFATALWARNINGS) $(LDLIBS) +IFFELDFLAGS= $(ZASSERTDEFLIB) $(ZFATALWARNINGS) $(LDLIBS) IFFELIBS= -lsocket -lnsl IFFEC= $(IFFECC) $(IFFECPPFLAGS) $(IFFECFLAGS) \ $(IFFELDFLAGS) $(IFFELIBS) @@ -58,14 +58,14 @@ FEATURE/% := SHADOW_CCS= FEATURE/%: $(ASTSRC)/features/% PATH=$(AST_TOOLS):$$PATH \ $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA) - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) FEATURE/%: $(ASTSRC)/features/%.c PATH=$(AST_TOOLS):$$PATH \ $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA) - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) FEATURE/%: $(ASTSRC)/features/%.sh PATH=$(AST_TOOLS):$$PATH \ $(AST_IFFE) $(IFFEFLAGS) -c '$(IFFEC)' run $< $(IFFE_EXTRA) - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) diff --git a/usr/src/cmd/ast/libast/Makefile.com b/usr/src/cmd/ast/libast/Makefile.com index 0a29efde91..bf12413e6f 100644 --- a/usr/src/cmd/ast/libast/Makefile.com +++ b/usr/src/cmd/ast/libast/Makefile.com @@ -119,7 +119,7 @@ ast/%:= FILEMODE= 0644 $(HEADERGEN:%=ast/%): $(FEATURES:%=FEATURE/%) src=`echo $(@F:%.h=%) | sed 's/^ast_//'`; \ $(AST_PROTO) FEATURE/$$src > $@ - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) ast/prototyped.h: $(AST_TOOLS)/proto $(MKDIR) -p $(@D) @@ -127,7 +127,7 @@ ast/prototyped.h: $(AST_TOOLS)/proto ast/ast_common.h: ast/prototyped.h $(AST_PROTO) FEATURE/common | $(GREP) -v 'define _def_map_' > $@ - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) $(CP) $@ . ast/lc.h: lc.h @@ -135,23 +135,23 @@ ast/lc.h: lc.h ast/%.h: $(ASTSRC)/include/%.h $(INS.file) - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) ast/%.h: $(ASTSRC)/comp/%.h $(INS.file) - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) ast/%.h: $(ASTSRC)/cdt/%.h $(INS.file) - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) ast/%.h: $(ASTSRC)/std/%.h $(INS.file) - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) ast/ast_namval.h: $(ASTSRC)/include/namval.h $(CP) $(ASTSRC)/include/namval.h $@ - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) CLOBBERFILES += ast_common.h t.c CLOBBERFILES += ast/* diff --git a/usr/src/cmd/ast/libast/Makefile.iffe b/usr/src/cmd/ast/libast/Makefile.iffe index e1a952188c..9471e98ae7 100644 --- a/usr/src/cmd/ast/libast/Makefile.iffe +++ b/usr/src/cmd/ast/libast/Makefile.iffe @@ -19,15 +19,25 @@ include ../../Makefile.iffe GENCONF= conflim.h conftab.c conftab.h LCCONF= lc.h lctab.c -$(GENCONF): FRC +# Unfortunately, due to differences in the "sed" command implemented in +# various illumos distributions, we can't portably use 'sed -i' here. +clean_%: % + { \ + tf=$$(mktemp /tmp/iffe.XXXXXXXXXX) && \ + $(SED) < "$<" > "$$tf" '$(SEDPATTERN)' && \ + $(CP) -p "$$tf" "$<" && \ + $(RM) "$$tf"; \ + } + +conftab.c: $(ASTSRC)/comp/conf.tab PATH=$(AST_TOOLS):$$PATH \ $(SHELL) $(ASTSRC)/comp/conf.sh -v $(ASTSRC)/comp/conf.tab \ $(IFFEC) - $(POST_PROCESS_AST) conflim.h conftab.c conftab.h +conflim.h conftab.h: conftab.c -$(LCCONF): $(ASTSRC)/port/lc.tab +lctab.c: $(ASTSRC)/port/lc.tab $(AST_LCGEN) $(LCCONF) < $(ASTSRC)/port/lc.tab - $(POST_PROCESS_AST) $(LCCONF) +lc.h: lctab.c FEATURE/limits: $(GENCONF) FEATURE/float: ast/ast_common.h @@ -35,4 +45,5 @@ FEATURE/float: ast/ast_common.h cleaniffe: FRC $(RM) $(FEATURES:%=FEATURE/%) $(GENCONF) $(LCCONF) -generate: cleaniffe $(FEATURES:%=FEATURE/%) $(LCCONF) +generate: cleaniffe $(FEATURES:%=FEATURE/%) $(LCCONF) \ + .WAIT $(GENCONF:%=clean_%) $(LCCONF:%=clean_%) diff --git a/usr/src/cmd/ast/libcmd/Makefile.com b/usr/src/cmd/ast/libcmd/Makefile.com index 484fa737c7..a8a8d34f2b 100644 --- a/usr/src/cmd/ast/libcmd/Makefile.com +++ b/usr/src/cmd/ast/libcmd/Makefile.com @@ -108,7 +108,7 @@ ast/cmdext.h: $(OBJECTS:%.o=$(ASTSRC)/%.c) >> $@.tmp $(AST_PROTO) -f $@.tmp >> $@ rm -f $@.tmp - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) CLOBBERFILES += ast/* diff --git a/usr/src/cmd/ast/libdll/Makefile.com b/usr/src/cmd/ast/libdll/Makefile.com index 94cc76115f..122cba86d9 100644 --- a/usr/src/cmd/ast/libdll/Makefile.com +++ b/usr/src/cmd/ast/libdll/Makefile.com @@ -90,7 +90,7 @@ $(HEADERGEN:%=ast/%): $(FEATURES:%=FEATURE/%) src=`echo $(@F:%.h=%) | sed 's/^ast_//'`; \ [[ $$src = dlldefs ]] && src=dll; \ $(AST_PROTO) FEATURE/$$src > $@ - $(POST_PROCESS_AST) $@ + $(POST_PROCESS_AST) install_h: $(HEADERGEN:%=ast/%) diff --git a/usr/src/cmd/ast/libsum/Makefile.com b/usr/src/cmd/ast/libsum/Makefile.com index d7446cba8c..9faf39baac 100644 --- a/usr/src/cmd/ast/libsum/Makefile.com +++ b/usr/src/cmd/ast/libsum/Makefile.com @@ -96,3 +96,5 @@ _feature: FRC $(MAKE) -f Makefile.iffe generate include ../../Makefile.astmsg + +FRC: |