summaryrefslogtreecommitdiff
path: root/yacc
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2018-09-17 14:51:01 +0200
committerSébastien Hinderer <Sebastien.Hinderer@inria.fr>2018-09-17 14:51:01 +0200
commit01b65ac0af7f361dbfbb1db34856fe632b603b9c (patch)
treec2e13da486073aac6d6bfe0befe1dde6cf5e802f /yacc
parentba6362a07d3445c2f4ee3dfe4f8585d8d4f7e1b7 (diff)
downloadocaml-01b65ac0af7f361dbfbb1db34856fe632b603b9c.tar.gz
Introduce and use ROOTDIR in more makefiles
Diffstat (limited to 'yacc')
-rw-r--r--yacc/Makefile28
1 files changed, 18 insertions, 10 deletions
diff --git a/yacc/Makefile b/yacc/Makefile
index fd9d7c03ba..d4a0c8ccc3 100644
--- a/yacc/Makefile
+++ b/yacc/Makefile
@@ -15,11 +15,19 @@
# Makefile for the parser generator.
-include ../Makefile.config
+ROOTDIR = ..
-OBJS= closure.$(O) error.$(O) lalr.$(O) lr0.$(O) main.$(O) \
- mkpar.$(O) output.$(O) reader.$(O) \
- skeleton.$(O) symtab.$(O) verbose.$(O) warshall.$(O)
+include $(ROOTDIR)/Makefile.config
+
+OC_CPPFLAGS += -I$(ROOTDIR)/runtime
+
+ocamlyacc_SOURCES := $(addsuffix .c,\
+ closure error lalr lr0 main mkpar output reader skeleton symtab verbose \
+ warshall)
+
+ocamlyacc_OBJECTS := $(ocamlyacc_SOURCES:.c=.$(O))
+
+generated_files := ocamlyacc$(EXE) $(ocamlyacc_OBJECTS) version.h
all: ocamlyacc$(EXE)
@@ -27,14 +35,14 @@ ifeq ($(TOOLCHAIN),cc)
MKEXE_ANSI=$(MKEXE)
endif
-ocamlyacc$(EXE): $(OBJS)
- $(MKEXE_ANSI) -o ocamlyacc$(EXE) $(OBJS) $(EXTRALIBS)
+ocamlyacc$(EXE): $(ocamlyacc_OBJECTS)
+ $(MKEXE_ANSI) -o $@ $^ $(EXTRALIBS)
-version.h : ../VERSION
- echo "#define OCAML_VERSION \"`sed -e 1q $^ | tr -d '\r'`\"" > $@
+version.h : $(ROOTDIR)/VERSION
+ echo "#define OCAML_VERSION \"`sed -e 1q $< | tr -d '\r'`\"" > $@
clean:
- rm -f *.$(O) ocamlyacc$(EXE) *~ version.h
+ rm -f $(generated_files)
depend:
@@ -55,4 +63,4 @@ warshall.$(O): defs.h
# also works for .obj files.
%.$(O): %.c
- $(CC) -c $(OC_CFLAGS) $(OC_CPPFLAGS) -I../runtime $(OUTPUTOBJ)$@ $<
+ $(CC) -c $(OC_CFLAGS) $(OC_CPPFLAGS) $(OUTPUTOBJ)$@ $<