chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.78k stars 418 forks source link

Add `-f` option to Mason for complicated builds #7832

Open buddha314 opened 6 years ago

buddha314 commented 6 years ago

With make I can do make -f Makefile.blah.de.blah and hold a variety of options for various build environments or targets. Please support something mason -f thisone.mason so I don't have to type all the -Ms out every time.

ben-albrecht commented 6 years ago

@buddha314 - Could you provide a few examples where this feature would be useful? I'm wondering if there are use cases that planned mason features will not support.

buddha314 commented 6 years ago

Yes, but I will concede to your expertise if there are better ways to handle some things. I think the most obvious one is the location of libraries on different systems. Particularly UBLAS.

My habit (and I don't know how "best-practicey" this is) is to create a make file for each build environment. For instance Makefile.macbuddha

include Makefile // defines most targets
BLAS_HOME= /usr/local/Cellar/openblas/0.2.20

vs Makefile.notesbox

include Makefile // defines most targets
BLAS_HOME= /opt/OpenBlas
ben-albrecht commented 6 years ago

In this instance, would it suffice to support reading environment variables in manifest files (Mason.toml), which could then be forwarded to compilation flags?

Long term, something like BLAS should be handled as an external dependency. I'd be curious if you had other use-cases that were unrelated to external dependencies.

buddha314 commented 6 years ago

As to environment variables, I'm completely open to suggestions that include examples. The need is to build on different systems with different library locations. I just hacked my own solution.

In data-intense applications, you need to test on more than one row of data or small json file. It's useful to have a "dev" database. I use my makefiles to provide db credentials for the dev environment vs the prod environment as well.

buddha314 commented 6 years ago

Oh, and another one. If I'm running on Swan I include some of the arguments like -nl=100000 in the make file. I usually have a make run so the execution is consistent.

buddha314 commented 6 years ago

Here is another example of this use. To run a test for one of my packages, I have multiple dependencies. In the Makefile I have included

AYATOLLAH_HOME=/Users/buddha/github/q/ayatollah
CHINGON_HOME=/Users/buddha/github/buddha314/chingon
NUMSUCH_HOME=/Users/buddha/github/buddha314/numsuch
CDO_HOME=/Users/buddha/github/cdo
CHREST_HOME=/Users/buddha/github/buddha314/chrest
BLAS_HOME=/usr/local/Cellar/openblas/0.2.20
POSTGRES_HOME=/usr/include/postgresql
API_HOST=127.0.0.1
API_PORT=8080

When I do the build, I can include local.mk and get all of these variables set. They need to be there for the compilation, not just run time. Is there a pattern for doing this with COMPOPTS ? Right now it looks like would all be crammed on to one line with no variable substitution.

Thanks!

marcoscleison commented 6 years ago

Another feature that we need is the ability of Mason to find C source code and inform the compiler about it. For example, I have a package X and inside src I have test.c . I need that mason helps to find test.c and inform the compiler.