Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some command switch to predefine output exe name? #51

Closed
zmiimz opened this issue Mar 16, 2015 · 3 comments
Closed

Some command switch to predefine output exe name? #51

zmiimz opened this issue Mar 16, 2015 · 3 comments

Comments

@zmiimz
Copy link

zmiimz commented Mar 16, 2015

Currently the name of executable is defined by the name of the file with "program/end program"? Can it be predefined manually using some option switch?

@szaghi
Copy link
Owner

szaghi commented Mar 16, 2015

Sure, this name can be customized. Presently, the following rules are used:

  • if no target is specified (-t/--target switch), i.e. all programs found are built, the output name(s) are made by means of the basename of the programs sources, e.g. if the programs found are src/foo.f90 and src/bar.f90 the output name are foo and bar;
  • if target is specified, thus only the target is built, the output name is made by the following rules:
    • if no output is specified (-o/--output switch) the output name follows the source basename rule as above;
    • if output is specified it is used as it;
  • the output name of libraries follow the same rules of programs except that if no output is specified the suffix .so or .a is automatically added.

Consequently, the program/end program name is not currently used, rather it is used the basename of sources. If you want specify other name you must use the -o/--output switch. It is worth noting that this switch can also be defined into a fobos file.

One limit is that currently only one target can be specified. However, if you want to define many targets it should be simple to extend FoBiS to accept a list instead of only one values.

See you soon.

@zmiimz
Copy link
Author

zmiimz commented Mar 20, 2015

Good explanation. thnx

@zmiimz zmiimz closed this as completed Mar 20, 2015
@tuncaen
Copy link

tuncaen commented Nov 11, 2021

Sure, this name can be customized. Presently, the following rules are used:

* if no target is specified (`-t`/`--target` switch), i.e. all programs found are built, the output name(s) are made by means of the `basename` of the programs sources, e.g. if the programs found are `src/foo.f90` and `src/bar.f90` the output name are `foo` and `bar`;

* if target is specified, thus only the target is built, the output name is made by the following rules:
  
  * if no output is specified (`-o`/`--output` switch) the output name follows the source `basename` rule as above;
  * if output is specified it is used as it;

* the output name of libraries follow the same rules of programs except that if no output is specified the suffix `.so` or `.a` is automatically added.

Consequently, the program/end program name is not currently used, rather it is used the basename of sources. If you want specify other name you must use the -o/--output switch. It is worth noting that this switch can also be defined into a fobos file.

One limit is that currently only one target can be specified. However, if you want to define many targets it should be simple to extend FoBiS to accept a list instead of only one values.

See you soon.

Very clear explanation; however, I couldn't getting what I expected, though I am using as you explained to create makefile by using fobos, i.e.;

...
target       = src/main.f90
output     = UIHES.exe
...

the output file is as in the following,

...
$(DEXE)0-MAIN: $(MKDIRS) $(DOBJ)0-main.o
	@rm -f $(filter-out $(DOBJ)0-main.o,$(EXESOBJ))
	@echo $(LITEXT)
	@$(FC) $(OPTSL) $(DOBJ)*.o $(LIBS) -o $@
EXES := $(EXES) 0-MAIN
...

Am I missing something?

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

No branches or pull requests

3 participants