summaryrefslogtreecommitdiff
path: root/asmrun
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2017-03-06 16:08:27 +0100
committerDamien Doligez <damien.doligez@gmail.com>2017-03-09 17:12:02 +0100
commitc24dc39454d37bb897742e9526e1dcaa4f02b519 (patch)
tree5d3d1977c3a9546ce7687d598307e1df604488fb /asmrun
parenta85b39654ab3f5a66f9558a94a4b57c87188e6d8 (diff)
downloadocaml-c24dc39454d37bb897742e9526e1dcaa4f02b519.tar.gz
asmrun/Makefile: dependencies generation fixup
When computing dependencies, make sure to take into account even the files which will not actually be compiled / linked on the platform where make depend is run. Typically, this means compute dependencies also for ../byterun/win32.c on Unix and vice versa.
Diffstat (limited to 'asmrun')
-rw-r--r--asmrun/Makefile17
1 files changed, 12 insertions, 5 deletions
diff --git a/asmrun/Makefile b/asmrun/Makefile
index f0d45c1b5b..39e279b99b 100644
--- a/asmrun/Makefile
+++ b/asmrun/Makefile
@@ -22,14 +22,21 @@ LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \
$(UNIX_OR_WIN32).c dynlink.c signals.c debugger.c startup_aux.c \
backtrace.c afl.c
+# The following variable stores the list of files for which dependencies
+# should be computed. It includes even the files that won't actually be
+# compiled on the platform where make depend is run
+sources := $(LINKEDFILES)
+
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
CC=$(NATIVECC)
ifeq "$(UNIX_OR_WIN32)" "win32"
LN = cp
+sources += ../byterun/unix.c
else
LN = ln -s
+sources += ../byterun/win32.c
endif
FLAGS=\
@@ -182,12 +189,12 @@ ifeq "$(TOOLCHAIN)" "msvc"
depend:
$(error Dependencies cannot be regenerated using the MSVC ports)
else
-depend: $(COBJS:.$(O)=.c) $(LINKEDFILES)
- $(CC) -MM $(FLAGS) *.c | sed -e 's/\.o/.$$(O)/' > .depend
- $(CC) -MM $(FLAGS) -DPROFILING *.c | sed -e 's/\.o/.p.$$(O)/' \
+depend: $(COBJS:.$(O)=.c) $(sources)
+ $(CC) -MM $(FLAGS) $^ | sed -e 's/\.o/.$$(O)/' > .depend
+ $(CC) -MM $(FLAGS) -DPROFILING $^ | sed -e 's/\.o/.p.$$(O)/' \
>> .depend
- $(CC) -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.d.$$(O)/' >> .depend
- $(CC) -MM $(FLAGS) -DCAML_INSTR *.c | sed -e 's/\.o/.i.$$(O)/' \
+ $(CC) -MM $(FLAGS) -DDEBUG $^ | sed -e 's/\.o/.d.$$(O)/' >> .depend
+ $(CC) -MM $(FLAGS) -DCAML_INSTR $^ | sed -e 's/\.o/.i.$$(O)/' \
>> .depend
endif