Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
stedolan committed Apr 21, 2021
1 parent f41ba60 commit 383187f
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions tools/Makefile
Expand Up @@ -13,19 +13,17 @@
#* *
#**************************************************************************

MAKEFLAGS := -r -R
ROOTDIR = ..
# NOTE: it is important that OCAMLLEX is defined *before* Makefile.common
# gets included, so that its definition here takes precedence
# over the one there.
OCAMLLEX ?= $(BOOT_OCAMLLEX)
include $(ROOTDIR)/Makefile.common

DESTDIR ?=
# Setup GNU make variables storing per-target source and target,
# a list of installed tools, and a function to quote a filename for
# the shell.
override installed_tools := ocamldep ocamlprof ocamlcp ocamloptp \
installed_tools := ocamldep ocamlprof ocamlcp ocamloptp \
ocamlmktop ocamlmklib ocamlobjinfo

install_files :=
Expand All @@ -45,33 +43,29 @@ COMPFLAGS = -absname -w +a-4-9-41-42-44-45-48-70 -strict-sequence \
LINKFLAGS = $(INCLUDES)
VPATH := $(filter-out -I,$(INCLUDES))

.PHONY: all allopt opt.opt # allopt and opt.opt are synonyms
allopt: opt.opt

programs_byte := \
ocamldep ocamlprof ocamlcp ocamloptp ocamlmklib \
ocamlmktop ocamlcmt dumpobj ocamlobjinfo \
primreq stripdebug cmpbyt
install_files += $(filter $(installed_tools), $(programs_byte))
programs_opt := $(programs_byte:%=%.opt)

programs_byte_exe := $(programs_byte:%=%$(EXE))
programs_opt_exe := $(programs_opt:%=%$(EXE))
ifneq "$(EXE)" ""
$(programs_byte) $(programs_opt): %: %$(EXE)
endif
$(foreach program, $(programs_byte) $(programs_opt),\
$(eval $(call PROGRAM_SYNONYM,$(program))))

$(programs_byte_exe):
$(programs_byte:%=%$(EXE)):
$(CAMLC) $(LINKFLAGS) -I $(ROOTDIR) -o $@ $(filter-out %.cmi,$^)

$(programs_opt_exe):
$(programs_opt:%=%$(EXE)):
$(CAMLOPT_CMD) $(LINKFLAGS) -I $(ROOTDIR) -o $@ $(filter-out %.cmi,$^)

all: $(programs_byte_exe)
opt.opt: $(programs_opt_exe)
.PHONY: all allopt opt.opt # allopt and opt.opt are synonyms
all: $(programs_byte)
opt.opt: $(programs_opt)
allopt: opt.opt
clean::
rm -f $(programs_byte) $(programs_byte_exe)
rm -f $(programs_opt) $(programs_opt_exe)
rm -f $(programs_byte) $(programs_byte:%=%.exe)
rm -f $(programs_opt) $(programs_opt:%=%.exe)

# The dependency generator

Expand Down

0 comments on commit 383187f

Please sign in to comment.