Skip to content

Refactored the makefile build system#28

Open
neal-ak wants to merge 45 commits intomasterfrom
remakefile
Open

Refactored the makefile build system#28
neal-ak wants to merge 45 commits intomasterfrom
remakefile

Conversation

@neal-ak
Copy link
Copy Markdown
Collaborator

@neal-ak neal-ak commented Jan 28, 2024

Major changes

  • Sources .f and .f90 found in ./src/
  • Objects .o and modules .mod are built to ./objs/
  • Library has been renamed to libgencap.so to follow convention
  • Library and testing executable are built to ./bin/
  • install.sh and cleanup.sh scripts can build and clean for the user

makefile

Has two build targets:

  • libgencap.so: the default target, builds the library
  • gentest.x: builds the testing executable program found in ./src/main.f90

and two cleaning targets:

  • clean: cleans all .o objects and .mod modules from the ./obj/ directories
  • nuke : invokes clean, in addition to clearing ./bin/libgencap.so and ./bin/gentest.x

It also checks if debug_mode is set to true or not to toggle debugging flags.

To Test

  1. Run make && make gentest.x && bin/gentest.x, and clean with make nuke.
  2. Then set it up for debug mode: export debug_mode=true, and test the make file commands again.
  3. Clean using make nuke again, and once complete disable debug mode: unset debug_mode; export debug_mode.
  4. To test the installing scripts, run ./install.sh -h, and then ./install.sh && ./install.sh -x && bin/gentest.x, and clean with ./cleanup.sh.
  5. Then do the same install script commands, adding the -g flag to both ./install.sh calls: ./install.sh -g && ./install.sh -gx && bin/gentest.x.

@aaronvincent
Copy link
Copy Markdown
Owner

Not sure what is going on - it's trying to compile dqelg with clang. Come to think of it, do we still need these libraries?

gfortran -fPIC -std=legacy -J obj -O3 -fopenmp -c src/numerical/dqag/dqelg.f -o obj/numerical/dqag/dqelg.o
clang -cc1as: error: unable to open output file 'obj/numerical/dqag/dqelg.o': 'No such file or directory'
make: *** [obj/numerical/dqag/dqelg.o] Error 1

@neal-ak
Copy link
Copy Markdown
Collaborator Author

neal-ak commented Feb 16, 2024

As to the error, my best guess is either the obj/numerical/dqag/ isn't being created by the makefile (it should be running mkdir -p obj/numerical/dqag if it doesn't exist yet) or it's a file permission issue as described in https://stackoverflow.com/questions/75349370/why-am-i-getting-a-cannot-open-file-error-with-gfortran-in-macos-ventura.

For the libraries we'll still need:

  • numerical/dqag/dqelg.f (numerical/dqag/dsntdqagse.f uses dqelg)
  • numerical/dqag/dqpsrt.f (numerical/dqag/dsntdqagse.f uses dqpsrt)
  • numerical/dqag/dsntdqagse.f (gencap.f90 and opercap.f90 use dsntdqagse for integrator)
  • numerical/dqag/dsntdqk21.f (numerical/dqag/dsntdqagse.f uses dsntdqk21)
  • numerical/d1mach.f (numerical/dgamic.f uses D1MACH)
  • numerical/dgamic.f (gencap.f90 and opercap.f90 use DGAMIC for Incomplete Gamma Fn)
  • numerical/fftpack.f90 (spergelpressmod.f90 uses dfft1i, dfft1f, and dfft1b for FFT)
  • numerical/pchip.f90 (transgen.f90 uses DPCHEZ for derivatives of T and L)
  • numerical/spline.f90 (spergelpressmod.f90 uses spline and ispline to prep array for FFT)

So I think numerical/sgolay.f90 and numerical/dqag/dqk21.f can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants