From f914171eaa8bcff7e5adb602afe5cab1361a591c Mon Sep 17 00:00:00 2001 From: Florian Margaine Date: Thu, 31 Dec 2020 23:20:46 +0100 Subject: [PATCH] improve makefiles Fix copy of header files. This was accidentally working thanks to the `cp -rf $(srcdir)/h/*.h` that existed, but it means that editing any header file (except the internal.h one) would not recompile appropriately. Replace deprecated suffix rules with modern equivalents, list header files as dependencies for .d files. --- src/Makefile.in | 16 ++-------------- src/c/Makefile.in | 27 +++++++++++++++++---------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 18f0af21f..cac919a08 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -83,19 +83,7 @@ endif %Makefile: $(srcdir)/%Makefile.in config.status ./config.status -# -# When compiling the library itself, we have to remove the dllimport -# declarations, because the variables that they mark are in the -# in the library and can be referenced without indirection. -# -c/ecl/external.h: $(top_srcdir)/h/external.h - test -d c/ecl || mkdir c/ecl - sed 's,__declspec(dllimport),,g' $(top_srcdir)/h/external.h > $@ - -ecl/external.h: c/ecl/external.h c/ecl/external.h - cp -rf $(srcdir)/h/*.h $(srcdir)/h/impl ecl/ - -bin/$(ECL): $(ECL_MIN) compile.lsp ecl/external.h build-stamp $(top_srcdir)/lsp/*.lsp $(top_srcdir)/clos/*.lsp $(top_srcdir)/*cmp/*.lsp +bin/$(ECL): $(ECL_MIN) compile.lsp build-stamp $(top_srcdir)/h/*.h $(top_srcdir)/h/impl/*.h $(top_srcdir)/lsp/*.lsp $(top_srcdir)/clos/*.lsp $(top_srcdir)/*cmp/*.lsp if [ -f CROSS-COMPILER ]; then \ ./CROSS-COMPILER compile; \ else \ @@ -139,7 +127,7 @@ libeclgmp.a: fi # final objects archive -libeclmin.a: libeclgmp.a libeclatomic.a libeclgc.a libeclffi.a lsp/config.lsp $(ECL_CMPDIR)/cmpdefs.lsp ecl/external.h +libeclmin.a: libeclgmp.a libeclatomic.a libeclgc.a libeclffi.a lsp/config.lsp $(ECL_CMPDIR)/cmpdefs.lsp @echo "Building $@..." cd c; $(MAKE) diff --git a/src/c/Makefile.in b/src/c/Makefile.in index 3dad7af3b..7e4958ebc 100644 --- a/src/c/Makefile.in +++ b/src/c/Makefile.in @@ -40,12 +40,16 @@ includedir=@includedir@ # Files HDIR = ../ecl -HFILES = $(HDIR)/config.h $(HDIR)/ecl.h $(HDIR)/ecl-cmp.h \ +HFILES = $(HDIR)/config.h $(HDIR)/ecl.h $(HDIR)/ecl-cmp.h \ $(HDIR)/object.h $(HDIR)/cs.h $(HDIR)/stacks.h \ $(HDIR)/external.h $(HDIR)/cons.h $(HDIR)/legacy.h \ - $(HDIR)/number.h $(HDIR)/page.h + $(HDIR)/number.h $(HDIR)/page.h $(HDIR)/bytecodes.h \ + $(HDIR)/cache.h $(HDIR)/config-internal.h $(HDIR)/ecl_atomics.h \ + $(HDIR)/ecl-inl.h $(HDIR)/internal.h $(HDIR)/stack-resize.h \ + $(HDIR)/impl/math_dispatch2.h $(HDIR)/impl/math_dispatch.h \ + $(HDIR)/impl/math_fenv.h $(HDIR)/impl/math_fenv_msvc.h CLOS_OBJS = clos/cache.o clos/accessor.o clos/instance.o clos/gfun.o -OBJS = main.o symbol.o package.o cons.o list.o apply.o eval.o \ +OBJS = main.o symbol.o package.o cons.o list.o apply.o eval.o \ interpreter.o compiler.o disassembler.o $(CLOS_OBJS) \ reference.o character.o file.o read.o print.o error.o \ string.o cfun.o reader/parse_integer.o reader/parse_number.o \ @@ -72,7 +76,6 @@ OBJS = main.o symbol.o package.o cons.o list.o apply.o eval.o \ unixfsys.o unixsys.o serialize.o ffi.o sse2.o @EXTRA_OBJS@ \ threads/atomic.o -.SUFFIXES: .c .o .d .s .PHONY: all ifndef VERBOSE @@ -81,16 +84,20 @@ endif all: $(DPP) ../libeclmin.a ../cinit.o -.d.c: $(DPP) +$(HDIR)/%.h: $(top_srcdir)/h/%.h + cp $< $@ + +$(HDIR)/impl/%.h: $(top_srcdir)/h/impl/%.h + mkdir -p $(HDIR)/impl + cp $< $@ + +%.c: %.d $(DPP) if test -f ../CROSS-DPP ; then ../CROSS-DPP $< $@ ; else $(DPP) $< $@ ; fi -.d.o: $(DPP) +%.o: %.d $(DPP) $(HFILES) if test -f ../CROSS-DPP ; then ../CROSS-DPP $< $@.c ; else $(DPP) $< $@.c ; fi $(CC) -DECLDIR="\"@ecldir@\"" $(CFLAGS) -o $@ $@.c -.c.o: $(HFILES) +%.o: %.c $(HFILES) $(CC) -DECLDIR="\"@ecldir@\"" $(CFLAGS) -o $@ $< -# .d.s: $(HFILES) -# if test -f ../CROSS-DPP ; then ../CROSS-DPP $< $@.c ; else $(DPP) $< $@.c ; fi -# $(CC) -DECLDIR="\"@ecldir@\"" $(CFLAGS) -S -o $@ $@.c ../libeclmin.a: $(OBJS) all_symbols.o all_symbols2.o $(RM) $@