factorize common makefile definitions in Makefile.common

master
Gabriel Scherer 2018-03-29 14:38:33 +02:00
parent afcd29eb0c
commit 3702f53692
13 changed files with 57 additions and 87 deletions

View File

@ -31,6 +31,7 @@
# make coreboot [new system -- now in a stable state]
include config/Makefile
include Makefile.common
# For users who don't read the INSTALL file
.PHONY: defaultentry
@ -274,17 +275,6 @@ MAXSAVED=boot/Saved/Saved.prev/Saved.prev/Saved.prev/Saved.prev/Saved.prev
COMPLIBDIR=$(LIBDIR)/compiler-libs
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_BINDIR=$(DESTDIR)$(BINDIR)
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
INSTALL_COMPLIBDIR=$(DESTDIR)$(COMPLIBDIR)
INSTALL_STUBLIBDIR=$(DESTDIR)$(STUBLIBDIR)
INSTALL_MANDIR=$(DESTDIR)$(MANDIR)
INSTALL_FLEXDLLDIR=$(INSTALL_LIBDIR)/flexdll
TOPINCLUDES=$(addprefix -I otherlibs/,$(filter-out %threads,$(OTHERLIBRARIES)))
RUNTOP=./byterun/ocamlrun ./ocaml \
-nostdlib -I stdlib \
@ -586,6 +576,9 @@ flexlink.opt:
mv flexlink.exe flexlink.opt && \
mv flexlink flexlink.exe
INSTALL_COMPLIBDIR=$(DESTDIR)$(COMPLIBDIR)
INSTALL_FLEXDLLDIR=$(INSTALL_LIBDIR)/flexdll
.PHONY: install-flexdll
install-flexdll:
cat stdlib/camlheader flexdll/flexlink.exe > \

30
Makefile.common Normal file
View File

@ -0,0 +1,30 @@
#**************************************************************************
#* *
#* OCaml *
#* *
#* Gabriel Scherer, projet Parsifal, INRIA Saclay *
#* *
#* Copyright 2018 Institut National de Recherche en Informatique et *
#* en Automatique. *
#* *
#* All rights reserved. This file is distributed under the terms of *
#* the GNU Lesser General Public License version 2.1, with the *
#* special exception on linking described in the file LICENSE. *
#* *
#**************************************************************************
# This makefile contains common definitions shared by other Makefiles
# We assume that config/Makefile has already been included
INSTALL ?= install
INSTALL_DATA ?= $(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG ?= $(INSTALL) -m u+rwx,g+rwx,o+rx
# note: these are defined by lazy expansions
# as some parts of the makefiles change BINDIR, etc.
# and expect INSTALL_BINDIR, etc. to stay in synch
# (see `shellquote` in tools/Makefile)
INSTALL_BINDIR = $(DESTDIR)$(BINDIR)
INSTALL_LIBDIR = $(DESTDIR)$(LIBDIR)
INSTALL_STUBLIBDIR = $(DESTDIR)$(STUBLIBDIR)
INSTALL_MANDIR = $(DESTDIR)$(MANDIR)

View File

@ -14,6 +14,7 @@
#**************************************************************************
include ../config/Makefile
include ../Makefile.common
LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \
compare.c ints.c floats.c str.c io.c extern.c intern.c hash.c sys.c \
@ -27,12 +28,6 @@ LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \
# compiled on the platform where make depend is run
sources := $(LINKEDFILES)
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
ifeq "$(UNIX_OR_WIN32)" "win32"
LN = cp
sources += ../byterun/unix.c

View File

@ -14,14 +14,7 @@
#**************************************************************************
include ../config/Makefile
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_BINDIR=$(DESTDIR)$(BINDIR)
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
INSTALL_INCDIR=$(INSTALL_LIBDIR)/caml
include ../Makefile.common
# The PROGRAMS (resp. LIBRARIES) variable list the files to build and
# install as programs in $(INSTALL_BINDIR) (resp. libraries in
@ -118,6 +111,8 @@ ld.conf: ../config/Makefile
echo "$(STUBLIBDIR)" > $@
echo "$(LIBDIR)" >> $@
INSTALL_INCDIR=$(INSTALL_LIBDIR)/caml
.PHONY: install
install:
$(INSTALL_PROG) $(PROGRAMS) "$(INSTALL_BINDIR)"

View File

@ -14,6 +14,8 @@
#**************************************************************************
include ../config/Makefile
include ../Makefile.common
UNIXDIR=../otherlibs/$(UNIXLIB)
CAMLRUN ?= ../boot/ocamlrun
CAMLYACC ?= ../boot/ocamlyacc
@ -27,12 +29,6 @@ CAMLLEX=$(CAMLRUN) ../boot/ocamllex
CAMLDEP=$(CAMLRUN) ../tools/ocamldep
DEPFLAGS=$(INCLUDES)
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_BINDIR=$(DESTDIR)$(BINDIR)
INCLUDES=\
-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../toplevel \
-I ../driver -I $(UNIXDIR)
@ -101,7 +97,7 @@ ocamldebug$(EXE): $(OBJS) $(OTHEROBJS)
$(CAMLC) $(LINKFLAGS) -o ocamldebug$(EXE) -linkall $(OTHEROBJS) $(OBJS)
install:
install -m $(MPROG) ocamldebug$(EXE) "$(INSTALL_BINDIR)/ocamldebug$(EXE)"
$(INSTALL_PROG) ocamldebug$(EXE) "$(INSTALL_BINDIR)/ocamldebug$(EXE)"
clean::
rm -f ocamldebug$(EXE)

View File

@ -13,6 +13,7 @@
#**************************************************************************
include ../config/Makefile
include ../Makefile.common
# Files to install
FILES= caml-font.el caml-hilit.el caml.el camldebug.el \
@ -40,10 +41,6 @@ COMPILECMD=(progn \
(byte-compile-file "caml-font.el") \
(byte-compile-file "camldebug.el"))
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
install:
@if test "$(EMACSDIR)" = ""; then \
$(EMACS) --batch --eval 't; see PR#5403'; \

View File

@ -16,6 +16,8 @@
ROOTDIR = ..
include $(ROOTDIR)/config/Makefile
include $(ROOTDIR)/Makefile.common
OCAMLRUN ?= $(ROOTDIR)/boot/ocamlrun
OCAMLYACC ?= $(ROOTDIR)/boot/ocamlyacc
@ -72,14 +74,6 @@ OCAMLDOC_LIBCMI=odoc_info.cmi
OCAMLDOC_LIBCMXA=odoc_info.cmxa
OCAMLDOC_LIBA=odoc_info.$(A)
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)/ocamldoc
INSTALL_BINDIR=$(DESTDIR)$(BINDIR)
INSTALL_MANODIR=$(DESTDIR)$(MANDIR)/man3
OCAMLDOC_LIBMLIS=odoc_info.mli
OCAMLDOC_LIBCMIS=$(OCAMLDOC_LIBMLIS:.mli=.cmi)
OCAMLDOC_LIBCMTS=$(OCAMLDOC_LIBMLIS:.mli=.cmt) $(OCAMLDOC_LIBMLIS:.mli=.cmti)
@ -290,6 +284,8 @@ odoc_see_lexer.ml: odoc_see_lexer.mll
# TODO: it may be good to split the following rule in several ones, e.g.
# install-programs, install-doc, install-libs
INSTALL_MANODIR=$(INSTALL_MANDIR)/man3
.PHONY: install
install:
$(MKDIR) "$(INSTALL_BINDIR)"

View File

@ -17,6 +17,8 @@
ROOTDIR=../..
include $(ROOTDIR)/config/Makefile
include $(ROOTDIR)/Makefile.common
CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun
CAMLYACC ?= $(ROOTDIR)/boot/ocamlyacc
@ -76,13 +78,6 @@ $(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A)
lib$(CLIBNAME).$(A): $(COBJS)
$(MKLIB) -oc $(CLIBNAME) $(COBJS) $(LDOPTS)
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
INSTALL_STUBLIBDIR=$(DESTDIR)$(STUBLIBDIR)
install::
if test -f dll$(CLIBNAME)$(EXT_DLL); then \
$(INSTALL_PROG) \

View File

@ -18,6 +18,8 @@
# FIXME reduce redundancy by including ../Makefile
include ../../config/Makefile
include ../../Makefile.common
CAMLRUN ?= ../../boot/ocamlrun
CAMLYACC ?= ../../boot/ocamlyacc
@ -88,12 +90,6 @@ dynlink.cmx: dynlink.cmi natdynlink.ml
extract_crc: dynlink.cma extract_crc.cmo
$(OCAMLC) -o extract_crc dynlink.cma extract_crc.cmo
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
install:
$(INSTALL_DATA) \
dynlink.cmi dynlink.cmti dynlink.cma dynlink.mli \

View File

@ -16,6 +16,7 @@
ROOTDIR=../..
include $(ROOTDIR)/config/Makefile
include $(ROOTDIR)/Makefile.common
CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun
CAMLYACC ?= $(ROOTDIR)/boot/ocamlyacc
@ -112,13 +113,7 @@ partialclean:
clean: partialclean
rm -f dllthreads*$(EXT_DLL) *.$(A) *.$(O)
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
INSTALL_THREADSLIBDIR=$(INSTALL_LIBDIR)/$(LIBNAME)
INSTALL_STUBLIBDIR=$(DESTDIR)$(STUBLIBDIR)
install:
if test -f dllthreads$(EXT_DLL); then \

View File

@ -16,6 +16,8 @@
# FIXME reduce redundancy by including ../Makefile
include ../../config/Makefile
include ../../Makefile.common
CAMLRUN ?= ../../boot/ocamlrun
CAMLYACC ?= ../../boot/ocamlyacc
@ -109,13 +111,6 @@ clean: partialclean
rm -f libvmthreads.a dllvmthreads.so *.o
rm -f stdlib.mli marshal.mli unix.mli
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
INSTALL_STUBLIBDIR=$(DESTDIR)$(STUBLIBDIR)
CMIFILES=thread.cmi mutex.cmi condition.cmi event.cmi threadUnix.cmi
install:

View File

@ -14,6 +14,8 @@
#**************************************************************************
include ../config/Makefile
include ../Makefile.common
CAMLRUN ?= ../boot/ocamlrun
CAMLYACC ?= ../boot/ocamlyacc
TARGET_BINDIR ?= $(BINDIR)
@ -83,12 +85,6 @@ allopt-noprof:
allopt-prof: stdlib.p.cmxa std_exit.p.cmx
rm -f std_exit.p.cmi
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
.PHONY: install
install::
$(INSTALL_DATA) \

View File

@ -15,22 +15,13 @@
MAKEFLAGS := -r -R
include ../config/Makefile
INSTALL=install
INSTALL_DATA=$(INSTALL) -m u+rw,g+rw,o+r
INSTALL_PROG=$(INSTALL) -m u+rwx,g+rwx,o+rx
INSTALL_BINDIR:=$(DESTDIR)$(BINDIR)
INSTALL_LIBDIR:=$(DESTDIR)$(LIBDIR)
INSTALL_COMPLIBDIR:=$(DESTDIR)$(COMPLIBDIR)
INSTALL_STUBLIBDIR:=$(DESTDIR)$(STUBLIBDIR)
INSTALL_MANDIR:=$(DESTDIR)$(MANDIR)
include ../Makefile.common
ifeq ($(SYSTEM),unix)
override define shellquote
$i := $$(subst ",\",$$(subst $$$$,\$$$$,$$(subst `,\`,$i)))#")#
endef
$(foreach i,BINDIR LIBDIR COMPLIBDIR STUBLIBDIR MANDIR,$(eval $(shellquote)))
$(foreach i,BINDIR LIBDIR STUBLIBDIR MANDIR,$(eval $(shellquote)))
endif
CAMLRUN ?= ../boot/ocamlrun