Skip to content

Commit

Permalink
Changed all rm in Makefiles and shells into /bin/rm.
Browse files Browse the repository at this point in the history
  • Loading branch information
roglo committed Feb 19, 2018
1 parent c79104c commit 27dcb49
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 50 deletions.
22 changes: 11 additions & 11 deletions Makefile
Expand Up @@ -49,20 +49,20 @@ depend:
for i in $(DIRS) compile; do (cd $$i; $(MAKE) depend; cd ..); done

install:
rm -rf "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)"
$(RM) -rf "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)"
for i in $(DIRS) compile; do \
(cd $$i; $(MAKE) install DESTDIR=$(DESTDIR); cd ..); \
done

uninstall:
rm -rf "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)"
cd "$(DESTDIR)$(BINDIR)"; rm -f *$(CAMLP5N)* odyl ocpp; cd ..
cd "$(DESTDIR)$(MANDIR)/man1"; rm -f *$(CAMLP5N)* odyl ocpp; cd ../..
$(RM) -rf "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)"
cd "$(DESTDIR)$(BINDIR)"; $(RM) -f *$(CAMLP5N)* odyl ocpp; cd ..
cd "$(DESTDIR)$(MANDIR)/man1"; $(RM) -f *$(CAMLP5N)* odyl ocpp

clean::
$(MAKE) clean_hot clean_cold
rm -f boot/*.cm[oi] boot/$(CAMLP5N)*
rm -rf boot/SAVED
$(RM) -f boot/*.cm[oi] boot/$(CAMLP5N)*
$(RM) -rf boot/SAVED
cd test; $(MAKE) clean; cd ..

scratch: clean
Expand All @@ -87,7 +87,7 @@ backup:
restore:
mv boot/SAVED boot.new
$(MAKE) mv_git FROM=boot TO=boot.new
rm -rf boot
$(RM) -rf boot
mv boot.new boot

promote:
Expand All @@ -111,7 +111,7 @@ compare_test:
done)

cleanboot:
rm -rf boot/SAVED/SAVED
$(RM) -rf boot/SAVED/SAVED


# Core and core bootstrap
Expand Down Expand Up @@ -183,15 +183,15 @@ compare_stolen:
# Bootstrap the sources

bootstrap_sources:
rm -rf ocaml_src.new
$(RM) -rf ocaml_src.new
mkdir ocaml_src.new
$(MAKE) new_sources
$(MAKE) untouch_sources
$(MAKE) promote_sources
$(MAKE) clean_sources

bootstrap_source:
rm -rf ocaml_src.new
$(RM) -rf ocaml_src.new
mkdir -p ocaml_src.new/$$DIR
$(MAKE) new_source DIR=$$DIR FILE=$$FILE
mv ocaml_src.new/$$DIR/$$FILE ocaml_src/$$DIR/$$FILE
Expand Down Expand Up @@ -350,7 +350,7 @@ unpromote_sources:
$(MAKE) mv_git FROM=ocaml_src.new TO=ocaml_src

clean_sources:
rm -rf ocaml_src/SAVED/SAVED
$(RM) -rf ocaml_src/SAVED/SAVED

printer:
cd etc; $(MAKE) $(PR_O)
Expand Down
8 changes: 4 additions & 4 deletions compile/Makefile
Expand Up @@ -16,11 +16,11 @@ out: $(CAMLP5N)$D.fast
opt: $(CAMLP5N)$D.fast.opt

$(CAMLP5N)$D.fast: pa_$D_fast.cmo
rm -f $(CAMLP5N)$D.fast
$(RM) -f $(CAMLP5N)$D.fast
cd ../main; $(MAKE) CAMLP5=../compile/$(CAMLP5N)$D.fast CAMLP5M="../compile/pa_$D_fast.cmo ../meta/pr_dump.cmo"

$(CAMLP5N)$D.fast.opt: pa_$D_fast.cmx
rm -f $(CAMLP5N)$D.fast.opt
$(RM) -f $(CAMLP5N)$D.fast.opt
cd ../main; $(MAKE) optp5 CAMLP5OPT=../compile/$(CAMLP5N)$D.fast.opt CAMLP5M="../compile/pa_$D_fast.cmx ../meta/pr_dump.cmx"

pa_$D_fast.ml: comp_head.ml.tpl $D_fast.ml.tmp comp_trail.ml.tpl
Expand All @@ -38,8 +38,8 @@ install:
fi

clean::
rm -f *.cm* *.pp[io] *.[oa] *.lib *.obj *.bak .*.bak *.out *.opt
rm -f *.fast tmp.* pa_*_fast.ml *_fast.ml.tmp
$(RM) -f *.cm* *.pp[io] *.[oa] *.lib *.obj *.bak .*.bak *.out *.opt
$(RM) -f *.fast tmp.* pa_*_fast.ml *_fast.ml.tmp

depend:
cp .depend .depend.bak
Expand Down
6 changes: 3 additions & 3 deletions compile/compile.sh
Expand Up @@ -25,8 +25,8 @@ echo "${OCAMLN}run$EXE ../meta/${CAMLP5N}r$EXE -nolib -I ../meta pa_macro.cmo pa
${OCAMLN}run$EXE ../meta/${CAMLP5N}r$EXE -nolib -I ../meta pa_macro.cmo pa_extend.cmo q_MLast.cmo -meta_action tmp.ml -o tmp.ppo
echo "${OCAMLN}c -I ../lib -I ../main -c -impl tmp.ppo" 1>&2
${OCAMLN}c -I ../lib -I ../main -c -impl tmp.ppo
echo "rm tmp.ppo" 1>&2
rm tmp.ppo
echo "/bin/rm tmp.ppo" 1>&2
/bin/rm tmp.ppo
echo "${OCAMLN}run$EXE ../main/${CAMLP5N}$EXE ./compile.cmo ./tmp.cmo ../etc/pr_r.cmo ../etc/pr_rp.cmo $ARGS -sep "\n\n" -impl - < /dev/null" 1>&2
${OCAMLN}run$EXE ../main/${CAMLP5N}$EXE ./compile.cmo ./tmp.cmo ../etc/pr_r.cmo ../etc/pr_rp.cmo $ARGS -sep "\n\n" -impl - < /dev/null
rm tmp.*
/bin/rm tmp.*
7 changes: 4 additions & 3 deletions config/Makefile.tpl
Expand Up @@ -5,6 +5,7 @@ OCAMLC=@OPT=$(OPT) EXE=$(EXE) OCAMLN=$(OCAMLN) ../tools/ocamlc.sh
OCAMLOPT=@OPT=$(OPT) EXE=$(EXE) OCAMLN=$(OCAMLN) ../tools/ocamlopt.sh
OCAMLCFLAGS=
MKDIR=mkdir -p
RM=/bin/rm
TEST_DIR=test `basename "$<"` = "$<" || { echo "File \"$<\" needs to be recompiled."; echo "Please run 'make' in directory '$$(dirname "$<")' first."; exit 1; }
COMPWITH=old

Expand All @@ -14,16 +15,16 @@ COMPWITH=old
@$(TEST_DIR)
@$(CAMLP5_COMM) $< -o $*.ppi
$(OCAMLC) $(OCAMLCFLAGS) -c -intf $*.ppi
rm -f $*.ppi
$(RM) -f $*.ppi

.ml.cmo:
@$(TEST_DIR)
@$(CAMLP5_COMM) $< -o $*.ppo
$(OCAMLC) $(OCAMLCFLAGS) -c -impl $*.ppo
rm -f $*.ppo
$(RM) -f $*.ppo

.ml.cmx:
@$(TEST_DIR)
@$(CAMLP5_COMM) $< -o $*.ppo
$(OCAMLOPT) $(OCAMLCFLAGS) -c -impl $*.ppo
rm -f $*.ppo
$(RM) -f $*.ppo
16 changes: 8 additions & 8 deletions etc/Makefile
Expand Up @@ -51,15 +51,15 @@ META: META.tpl


$(CAMLP5N)o$(EXE): ../main/$(CAMLP5N)$(EXE) $(CAMLP5OM)
rm -f $(CAMLP5N)o$(EXE)
$(RM) -f $(CAMLP5N)o$(EXE)
cd ../main; $(MAKE) CAMLP5=../etc/$(CAMLP5N)o$(EXE) CAMLP5M="-I ../etc $(CAMLP5OM)"

$(CAMLP5N)sch$(EXE): ../main/$(CAMLP5N)$(EXE) $(CAMLP5SCHM)
rm -f $(CAMLP5N)sch$(EXE)
$(RM) -f $(CAMLP5N)sch$(EXE)
cd ../main; $(MAKE) CAMLP5=../etc/$(CAMLP5N)sch$(EXE) CAMLP5M="-I ../etc $(CAMLP5SCHM)"

$(CAMLP5N)o.opt: $(CAMLP5OMX)
rm -f $(CAMLP5N)o.opt
$(RM) -f $(CAMLP5N)o.opt
cd ../main; $(MAKE) optp5 CAMLP5OPT=../etc/$(CAMLP5N)o.opt CAMLP5M="-I ../etc $(CAMLP5OMX)"

mk$(CAMLP5N).sh: mkcamlp5.sh.tpl
Expand All @@ -81,15 +81,15 @@ bootstrap_l:
ocamlrun$(EXE) ../boot/$(CAMLP5N) ./pa_$Lr.cmo -I ../boot pa_extend.cmo ./pr_r.cmo ./pr_extend.cmo ./pr_rp.cmo ./q_phony.cmo pa_$L.ml > tmp
mv pa_$Lr.ml pa_$Lr.ml.old
sed -e 's/^;; \(.*\)$$/(* \1 *)/' -e 's/^; \(.*\)$$/(* \1 *)/' -e 's|./pa_$Lr.cmo|pa_r.cmo pa_rp.cmo|' -e 's/$$Id.*\$$/File generated by pretty print; do not edit!/' tmp > pa_$Lr.ml
rm -f tmp
$(RM) -f tmp

compare_l:
ocamlrun$(EXE) ../boot/$(CAMLP5N) ./pa_$Lr.cmo -I ../boot pa_extend.cmo ./pr_r.cmo ./pr_extend.cmo ./pr_rp.cmo ./q_phony.cmo pa_$L.ml | sed -e 's/^;; \(.*\)$$/(* \1 *)/' -e 's/^; \(.*\)$$/(* \1 *)/' -e 's|./pa_$Lr.cmo|pa_r.cmo pa_rp.cmo|' -e 's/$$Id.*\$$/File generated by pretty print; do not edit!/' | diff -c pa_$Lr.ml -

clean::
rm -f *.cm* *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak *.out *.opt
rm -f mk$(CAMLP5N).sh mk$(CAMLP5N).opt.sh $(CAMLP5N)o$(EXE) $(CAMLP5N)sch$(EXE)
rm -f META
$(RM) -f *.cm* *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak *.out *.opt
$(RM) -f mk$(CAMLP5N).sh mk$(CAMLP5N).opt.sh $(CAMLP5N)o$(EXE) $(CAMLP5N)sch$(EXE)
$(RM) -f META

depend:
cp .depend .depend.bak
Expand All @@ -103,7 +103,7 @@ get_promote:

install:
-$(MKDIR) "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)" "$(DESTDIR)$(BINDIR)"
rm -f "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)/pa_lex.cmo"
$(RM) -f "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)/pa_lex.cmo"
cp $(OBJS) "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)/."
cp lib.sml "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)/."
cp $(CAMLP5N)o$(EXE) $(CAMLP5N)sch$(EXE) "$(DESTDIR)$(BINDIR)/."
Expand Down
4 changes: 2 additions & 2 deletions lib/Makefile
Expand Up @@ -18,8 +18,8 @@ $(TARGET:.cma=.cmxa): $(OBJS:.cmo=.cmx)
$(OCAMLOPT) $(OBJS:.cmo=.cmx) -a -o $(TARGET:.cma=.cmxa)

clean::
rm -f *.cm[ioax] *.cmxa *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak
rm -f $(TARGET)
$(RM) -f *.cm[ioax] *.cmxa *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak
$(RM) -f $(TARGET)

depend:
cp .depend .depend.bak
Expand Down
4 changes: 2 additions & 2 deletions main/Makefile
Expand Up @@ -38,8 +38,8 @@ crc.cmo: $(CAMLP5_OBJS_0)
$(OCAMLC) -c -impl crc.tmp

clean::
rm -f *.cm* *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak *.out *.opt
rm -f $(CAMLP5) crc.tmp
$(RM) -f *.cm* *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak *.out *.opt
$(RM) -f $(CAMLP5) crc.tmp

depend:
cp .depend .depend.bak
Expand Down
6 changes: 3 additions & 3 deletions man/Makefile
Expand Up @@ -7,7 +7,7 @@ TARGET=$(CAMLP5N).1
all: $(TARGET)

clean::
rm -f $(TARGET)
$(RM) -f $(TARGET)

depend:

Expand All @@ -17,10 +17,10 @@ install:
-$(MKDIR) "$(DESTDIR)$(MANDIR)/man1"
-cp $(TARGET) "$(DESTDIR)$(MANDIR)/man1/."
for i in $(CAMLP5N)o.1 $(CAMLP5N)r.1 $(CAMLP5N)sch.1 mk$(CAMLP5N).1 ocpp5.1; do \
cd "$(DESTDIR)$(MANDIR)/man1"; rm -f $$i; ln -s $(TARGET) $$i; \
cd "$(DESTDIR)$(MANDIR)/man1"; $(RM) -f $$i; ln -s $(TARGET) $$i; \
done
for i in $(CAMLP5N)o.opt.1 $(CAMLP5N)r.opt.1 mk$(CAMLP5N).opt.1; do \
cd "$(DESTDIR)$(MANDIR)/man1"; rm -f $$i; ln -s $(TARGET) $$i; \
cd "$(DESTDIR)$(MANDIR)/man1"; $(RM) -f $$i; ln -s $(TARGET) $$i; \
done

$(CAMLP5N).1: camlp5.1.tpl
Expand Down
6 changes: 3 additions & 3 deletions meta/Makefile
Expand Up @@ -16,15 +16,15 @@ all: $(COUT)
opt: $(COPT)

$(CAMLP5N)r$(EXE): ../main/$(CAMLP5N)$(EXE) $(CAMLP5RM)
rm -f $(CAMLP5N)r$(EXE)
$(RM) -f $(CAMLP5N)r$(EXE)
cd ../main; $(MAKE) CAMLP5=../meta/$(CAMLP5N)r$(EXE) CAMLP5M="-I ../meta $(CAMLP5RM)"

$(CAMLP5N)r.opt: $(CAMLP5RMX)
rm -f $(CAMLP5N)r.opt
$(RM) -f $(CAMLP5N)r.opt
cd ../main; $(MAKE) optp5 CAMLP5OPT=../meta/$(CAMLP5N)r.opt CAMLP5M="-I ../meta $(CAMLP5RMX)"

clean::
rm -f *.cm* *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak $(COUT) $(COPT)
$(RM) -f *.cm* *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak $(COUT) $(COPT)

depend:
cp .depend .depend.bak
Expand Down
4 changes: 2 additions & 2 deletions ocpp/Makefile
Expand Up @@ -15,8 +15,8 @@ ocpp$(EXE): $(OBJS)
$(OCAMLC) $(LINKFLAGS) ../boot/versdep.cmo ../boot/ploc.cmo ../boot/stdpp.cmo ../main/quotation.cmo ../odyl/odyl.cma $(OBJS) ../odyl/odyl.cmo -linkall -o ocpp$(EXE)

clean::
rm -f *.cm[ioa] *.pp[io] *.[ao] *.obj *.lib *.out *.bak .*.bak
rm -f ocpp$(EXE)
$(RM) -f *.cm[ioa] *.pp[io] *.[ao] *.obj *.lib *.out *.bak .*.bak
$(RM) -f ocpp$(EXE)

install:
-$(MKDIR) "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)" "$(DESTDIR)$(BINDIR)"
Expand Down
6 changes: 3 additions & 3 deletions odyl/Makefile
Expand Up @@ -27,7 +27,7 @@ odyl.cmxa: $(OBJS:.cmo=.cmx)
odyl_main.cmx: odyl_main.ml
$(CAMLP5_COMM) -DOPT -o odyl_main.ppo odyl_main.ml
$(OCAMLOPT) -c -impl odyl_main.ppo
rm -f odyl_main.ppo
$(RM) -f odyl_main.ppo

odyl_config.ml:
echo "let standard_library =" > odyl_config.ml
Expand All @@ -36,8 +36,8 @@ odyl_config.ml:
sed -e 's|\\|/|g' >> odyl_config.ml

clean::
rm -f *.cm* *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak *.out *.opt
rm -f odyl_config.ml odyl$(EXE)
$(RM) -f *.cm* *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak *.out *.opt
$(RM) -f odyl_config.ml odyl$(EXE)

depend:
cp .depend .depend.bak
Expand Down
3 changes: 2 additions & 1 deletion test/Makefile
Expand Up @@ -2,11 +2,12 @@
# Copyright (c) INRIA 2007-2017

DEP=../etc/pr_r.cmo quot_r.out.ml
RM=/bin/rm

all: quot_r.mlt quot_r.mlu quot_o.mlu

clean:
rm -f *.ml[tu]
$(RM) -f *.ml[tu]

compare_quot:
./mkquot.sh | diff quot_r.out.ml -
Expand Down
2 changes: 1 addition & 1 deletion test/check_ocaml_sources.sh
Expand Up @@ -207,4 +207,4 @@ for i in $files; do
main/camlp5 etc/pa_o.cmo meta/pr_dump.cmo -no_quot /tmp/t2.$suff > /dev/null
fi
done
# rm -f /tmp/t1.$suff /tmp/t2.$suff /tmp/t3.$suff
# /bin/rm -f /tmp/t1.$suff /tmp/t2.$suff /tmp/t3.$suff
6 changes: 3 additions & 3 deletions test/check_ocaml_versions.sh
Expand Up @@ -81,8 +81,8 @@ for i in $vers; do
echo date: $(date) version: $i
echo "+++++ cd $OCAMLSDIR"
cd $OCAMLSDIR
echo "+++++ rm -rf $OCAMLWDIR"
rm -rf $OCAMLWDIR
echo "+++++ /bin/rm -rf $OCAMLWDIR"
/bin/rm -rf $OCAMLWDIR
echo "+++++ git worktree prune"
git worktree prune
echo "+++++ git worktree add $OCAMLWDIR tags/$i"
Expand Down Expand Up @@ -129,7 +129,7 @@ for i in $vers; do
time make world.opt
fi
echo "+++++ make install"
rm -rf $TOP/usr/lib/ocaml
/bin/rm -rf $TOP/usr/lib/ocaml
make install
echo "+++++ make clean"
if [ -f "Makefile.bak" ]; then mv Makefile.bak Makefile; fi
Expand Down
2 changes: 1 addition & 1 deletion top/Makefile
Expand Up @@ -34,7 +34,7 @@ $(CAMLP5N)_top.cma: $(OBJS)
$(OCAMLC) $(OBJS) -a -o $(CAMLP5N)_top.cma

clean::
rm -f *.cm[ioa] *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak $(TARGET)
$(RM) -f *.cm[ioa] *.pp[io] *.[ao] *.obj *.lib *.bak .*.bak $(TARGET)

depend:
cp .depend .depend.bak
Expand Down

8 comments on commit 27dcb49

@vbgl
Copy link

@vbgl vbgl commented on 27dcb49 Feb 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roglo I’m curious about the rationale of such a change. I’ve got a use case in which a shell is able to resolve rm but not /bin/rm.

See a failing log

@roglo
Copy link
Contributor Author

@roglo roglo commented on 27dcb49 Feb 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was because some people redefine "rm" as being "/bin/rm -i", for example. But I recognize that, since I use the "-f" option, it may be not necessary. Is it a problem? I can undo this change, or define RM=rm.

@jpathy
Copy link

@jpathy jpathy commented on 27dcb49 Sep 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, hardcoding /bin/rm doesn't seem ideal, it fails to install using opam on nixos for e.g.

@roglo
Copy link
Contributor Author

@roglo roglo commented on 27dcb49 Oct 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something I have to change, to merge, to commit ? Sorry, I am not very used to github.

@jpathy
Copy link

@jpathy jpathy commented on 27dcb49 Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to undo this change and use rm without absolute paths.

@roglo
Copy link
Contributor Author

@roglo roglo commented on 27dcb49 Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but some people redefine 'rm' as an alias. For example as 'rm -i'. Isn't it a problem?

@jpathy
Copy link

@jpathy jpathy commented on 27dcb49 Oct 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, it's not an problem if user can pass RM env to make? but this patch hardcodes the variable in someplaces, someplaces it just uses /bin/rm .

@roglo
Copy link
Contributor Author

@roglo roglo commented on 27dcb49 Oct 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I fixed all of that. You can now do 'make' for 'rm' and 'make RM=/bin/rm' (or other) for '/bin/rm'. And I made the release 7.07 compatible with ocaml 4.07.1.

Please sign in to comment.