diff options
Diffstat (limited to 'usr/src/cmd/nsadmin/Makefile')
-rw-r--r-- | usr/src/cmd/nsadmin/Makefile | 93 |
1 files changed, 57 insertions, 36 deletions
diff --git a/usr/src/cmd/nsadmin/Makefile b/usr/src/cmd/nsadmin/Makefile index 533351bd86..45bdcc6701 100644 --- a/usr/src/cmd/nsadmin/Makefile +++ b/usr/src/cmd/nsadmin/Makefile @@ -25,64 +25,85 @@ # Copyright 2019 Joyent, Inc. # -PROG= profile .login ksh.kshrc system -PROGSKEL= .profile .kshrc -PROGROOT= .profile .bashrc +ETCFILES = profile .login ksh.kshrc system zshrc +ETCSKELFILES = .profile .kshrc .bashrc +ETCBASHFILES = bash_completion +ETCBASHCOMPLETIONDFILES = dladm zones zone_alias +ROOTFILES = .profile .bashrc .bash_profile include ../Makefile.cmd -ROOTROOT= $(ROOT)/root +ROOTETCFILES = $(ETCFILES:%=$(ROOTETC)/%) ROOTETCSKEL= $(ROOTETC)/skel -ROOTETCSKELPROG= $(PROGSKEL:%=$(ROOTETCSKEL)/%) +ROOTETCSKELFILES = $(ETCSKELFILES:%=$(ROOTETCSKEL)/%) ROOTETCVERSIONS= $(ROOTETC)/versions -ROOTETCVERSIONSPROG= $(ROOTETCVERSIONS)/build -ROOTROOTPROG= $(PROGROOT:%=$(ROOTROOT)/%) +ROOTETCVERSIONSFILES = $(ROOTETCVERSIONS)/build +ETCBASHDIR = $(ROOTETC)/bash +ROOTETCBASHFILES = $(ETCBASHFILES:%=$(ETCBASHDIR)/%) +ETCBASHCOMPLETIONDDIR = $(ETCBASHDIR)/bash_completion.d +ROOTETCBASHCOMPLETIONDFILES = \ + $(ETCBASHCOMPLETIONDFILES:%=$(ETCBASHCOMPLETIONDDIR)/%) +ROOTROOT= $(ROOT)/root +ROOTROOTFILES = $(ROOTFILES:%=$(ROOTROOT)/%) + +FILES = $(ROOTETCFILES) $(ROOTETCSKELFILES) \ + $(ROOTETCBASHFILES) $(ROOTETCBASHCOMPLETIONDFILES) \ + $(ROOTROOTFILES) $(ROOTETCVERSIONSFILES) + FILEMODE= 0644 -CLOBBERFILES = profile .bashrc .profile .login .kshrc +.KEEP_STATE: + +all: + +# Use $^ instead of $< - it's broken without % +INS.file = $(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $^ +INS.rename = $(INS.file); $(MV) $(@D)/$(^F) $@ + +$(ROOTROOT) \ +$(ROOTETCVERSIONS) \ +$(ETCBASHDIR) \ +$(ROOTETCBASHCOMPLETIONDDIR) \ +$(ROOTETCSKEL): + $(INS.dir) -.login: login.csh - $(RM) .login - $(CP) login.csh .login +$(ROOTETC)/profile: etc-profile.sh + $(INS.rename) -profile: etc-profile.sh - $(RM) profile - $(CP) etc-profile.sh $@ +$(ROOTETC)/.login: login.csh + $(INS.rename) -.profile: dot-profile.sh - $(RM) .profile - $(CP) dot-profile.sh $@ +# skel file and root's default +$(ROOTROOT)/.kshrc $(ROOTETCSKEL)/.kshrc: dot-kshrc.sh + $(INS.rename) -.kshrc: dot-kshrc.sh - $(RM) .kshrc - $(CP) dot-kshrc.sh $@ +# skel file and root's default +$(ROOTROOT)/.profile $(ROOTETCSKEL)/.profile: dot-profile.sh + $(INS.rename) -.bashrc: bashrc.sh - $(RM) .bashrc - $(CP) bashrc.sh $@ +$(ROOTETCSKEL)/.bashrc: etc-skel-bashrc.sh + $(INS.rename) -.KEEP_STATE: +$(ROOTROOT)/.bash_profile: dot-bash_profile.sh + $(INS.rename) -all: $(PROG) $(PROGSKEL) +$(ROOTROOT)/.bashrc: dot-bashrc.sh + $(INS.rename) -$(ROOTROOT)/% \ -$(ROOTETCSKEL)/%: % +$(ROOTETCBASHDIR)/%: % $(INS.file) -$(ROOTROOT) \ -$(ROOTETCVERSIONS) \ -$(ROOTETCSKEL): - $(INS.dir) +$(ROOTETCBASHCOMPLETIONDDIR)/%: % + $(INS.file) -$(ROOTETCVERSIONSPROG): $(ROOTETCVERSIONS) FRC +$(ROOTETCVERSIONSFILES): $(ROOTETCVERSIONS) FRC if [[ -n "$$BUILDVERSION_EXEC" ]]; then \ - $$BUILDVERSION_EXEC >$(ROOTETCVERSIONSPROG) ; \ + $$BUILDVERSION_EXEC >$(ROOTETCVERSIONSFILES) ; \ else \ - touch $(ROOTETCVERSIONSPROG) ; \ + touch $(ROOTETCVERSIONSFILES) ; \ fi -install: all $(ROOTETCSKEL) $(ROOTETCPROG) \ - $(ROOTETCSKELPROG) $(ROOTROOTPROG) $(ROOTETCVERSIONSPROG) +install: all $(FILES) clean: |