Commits

camlspotter  committed 4768043

ocamlspot is now a symlink to ocamlspot.opt where ocamlopt is available. Otherwise to ocamlspot.byt

  • Participants
  • Parent commits b6349f0

Comments (0)

Files changed (2)

 
 XOBJS=		$(addsuffix .cmx, $(MODULES))
 
-all: ocamlspot 
+WITH_OCAMLOPT=$(shell which ocamlopt)
 
-.PHONY: test
+ifeq ($(WITH_OCAMLOPT),)
+all: byt
+else
+all: byt opt
+endif
+
+byt: ocamlspot.byt ocamlspot
+
+opt: ocamlspot.opt ocamlspot
+
+
+.PHONY: test byt opt
 
 tests:
 	(cd tests; $(MAKE))
 
-ocamlspot: $(COMPOBJS) $(OBJS)
+# At install, we must do it differently.
+ifeq ($(WITH_OCAMLOPT),)
+ocamlspot: ocamlspot.opt
+	ln -s ocamlspot.byt ocamlspot
+else   
+ocamlspot: ocamlspot.byt
+	ln -s ocamlspot.opt ocamlspot
+endif
+
+ocamlspot.byt: $(COMPOBJS) $(OBJS)
 	$(OCAMLC) -o $@ $(COMPFLAGS) $(COMPOBJS) unix.cma ocamlcommon.cma $(OBJS)
 
-opt.opt: ocamlspot.opt
-
 ocamlspot.opt: $(COMPXOBJS) $(XOBJS)
 	$(OCAMLOPT) -o $@ $(COMPFLAGS) $(COMPXOBJS) unix.cmxa ocamlcommon.cmxa $(XOBJS)
 
-#	$(CAMLOPT) $(LINKFLAGS) -ccopt "$(BYTECCLINKOPTS)" -o ocamlc.opt \
-#	  $(COMPOBJS:.cmo=.cmx) \
-#	  asmrun/meta.o asmrun/dynlink.o -cclib "$(BYTECCLIBS)"
-#	@sed -e 's|@compiler@|$$topdir/ocamlc.opt|' \
-#	  driver/ocamlcomp.sh.in > ocamlcomp.sh
-#	@chmod +x ocamlcomp.sh
-
-
-opt: ocamlspot.opt
-
-.PHONY: opt opt.opt
 
 clean:
-	rm -f ocamlspot ocamlspot.opt *.cm* *.o *.annot *.sp*t 
+	rm -f ocamlspot ocamlspot.byt ocamlspot.opt *.cm* *.o *.annot *.sp*t 
 	(cd tests; $(MAKE) clean)
 
 # generic rules :
 	  cd $(EMACSDIR); $(EMACS) --batch --eval '$(COMPILECMD)'; \
 	fi
 
-install installopt::
-	cp ocamlspot $(BINDIR)/ocamlspot$(EXE)
-	if test -f ocamlspot.opt; \
-	  then cp ocamlspot.opt $(BINDIR)/ocamlspot.opt$(EXE); else :; fi
+install:: ocamlspot.byt
+	cp ocamlspot.byt $(BINDIR)/ocamlspot.byt$(EXE)
 	# The following is optional
 	# $(MAKE) install-elisp
 
+ifneq ($(WITH_OCAMLOPT),)
+install:: ocamlspot.opt
+	cp ocamlspot.opt $(BINDIR)/ocamlspot.opt$(EXE)
+endif
+
+ifeq ($(WITH_OCAMLOPT),)
+install:: 
+	rm -f $(BINDIR)/ocamlspot$(EXE)
+	ln -s $(BINDIR)/ocamlspot.byt$(EXE) $(BINDIR)/ocamlspot$(EXE)
+else
+install:: 
+	rm -f $(BINDIR)/ocamlspot$(EXE)
+	ln -s $(BINDIR)/ocamlspot.opt$(EXE) $(BINDIR)/ocamlspot$(EXE)
+endif
+
 uninstall::
+	rm -f $(BINDIR)/ocamlspot.byt$(EXE)
+	rm -f $(BINDIR)/ocamlspot.opt$(EXE)
 	rm -f $(BINDIR)/ocamlspot$(EXE)
-	rm -f $(BINDIR)/ocamlspot.opt$(EXE)
 
 test: ocamlspot ocamlspot.cmo
 	tests/auto-test.pl ocamlspot.ml treeset.ml xset.ml 

File ocamlspot.sh

 if [ -x $DIR/ocamlspot.opt ]; then 
   $DIR/ocamlspot.opt $*
 else 
-  if [ -x $DIR/ocamlspot ]; then 
-    $DIR/ocamlspot $*
+  if [ -x $DIR/ocamlspot.byt ]; then 
+    $DIR/ocamlspot.byt $*
   else 
-    echo "ERROR: No ocamlspot.opt or ocamlspot found at $DIR"
+    echo "ERROR: No ocamlspot.opt or ocamlspot.byt found at $DIR"
   fi
 fi