Menu

#5 patch: Makefile improvements

v1.0_(example)
open
nobody
patch (1)
5
2021-01-11
2021-01-11
No

Hi!

This is a patch from Debian contributors. If you still maintain the software, please consider if you can apply this to estscan 3.0.3.

We decided to apply the changes for these reasons:

  1. to supply the distribution's CFLAGS, CPPFLAGS, FFLAGS and LDFLAGS as environment variables
  2. change the default Fortran compiler, as gfortran has replaced g77
  3. while linking, we must specify any libraries after the .o files that use them since we are using the linker with -Wl,--as-needed.
Author: Steffen Moeller <moeller@debian.org>,
        Logan Rosen <logan@ubuntu.com>,
        Juhani Numminen <juhaninumminen0@gmail.com>
Last-Update: Mon, 11 Jan 2021 15:18:03 +0200
Bug-Debian: https://bugs.debian.org/916740
Description: Fix Fortran compiler name,
 accommodate CFLAGS, CPPFLAGS and FFLAGS as envvars (for hardening),
 put LDLIBS after .o files because linking with -Wl,--as-needed.

--- a/Makefile
+++ b/Makefile
@@ -2,10 +2,10 @@
 # Set the appropriate compilers and options for your system:
 # Any system with GNU compilers:
  CC = gcc

- CFLAGS = -O2
- F77 = g77
- FFLAGS = -O2
- LDFLAGS = -lm
+ CFLAGS ?= -O2
+ F77 = gfortran
+ FFLAGS ?= -O2
+ LDLIBS = -lm

 # Linux with Intel compilers:
 # CC = icc
@@ -21,19 +21,19 @@
    \rm -f *~ $(PROGS) *.o

 maskred: maskred.o

-   $(CC) $(LDFLAGS) -o $@ $<
+   $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)

 makesmat: makesmat.o

-   $(CC) $(LDFLAGS) -o $@ $<
+   $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)

 estscan: estscan.o

-   $(CC) $(LDFLAGS) -o $@ $<
+   $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)

 winsegshuffle: winsegshuffle.o

-   $(F77) $(LDFLAGS) -o $@ $<
+   $(F77) $(LDFLAGS) -o $@ $< $(LDLIBS)

 .c.o:

-   $(CC) $(CFLAGS) -c $<
+   $(CC) $(CPPFLAGS) $(CFLAGS) -c $<

 .f.o:
    $(F77) $(FFLAGS) -c $<

Discussion


Log in to post a comment.

MongoDB Logo MongoDB