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

Additional targets via external Makefile(s) #8

Closed
lbraglia opened this issue May 19, 2014 · 9 comments
Closed

Additional targets via external Makefile(s) #8

lbraglia opened this issue May 19, 2014 · 9 comments

Comments

@lbraglia
Copy link
Contributor

Hi,

Nice project, thanks.

Have you maybe considered allowing the user to add targets via external Makefiles?

eg this is a quick implementation, but has been quite handy to me

https://github.com/lbraglia/maker/blob/master/Makefile

currently additional Makefiles are stored in maker/makefiles and are sourced via make's include. Eg In my copy I use additional project-specific makefiles, that aim to ease working on other's R project on github eg

openxlsx_all:
    make help

openxlsx_get:
    rm -rf openxlsx* && \
    git clone https://github.com/lbraglia/openxlsx.git

openxlsx_remote:
    cd openxlsx && \
    git remote add upstream https://github.com/awalker89/openxlsx.git

openxlsx_setup: openxlsx_get openxlsx_remote

openxlsx_update:
    cd openxlsx && \
    git fetch upstream && \
    git checkout master &&  \
    git merge upstream/master && git push

openxlsx_test: 
    R -e "library(openxlsx); example(writeData, run.dontrun = TRUE)" && \
    libreoffice classTests.xlsx && \
    rm classTests.xlsx

Anyway, thanks.

Cheers,
Luca

@lbraglia lbraglia changed the title Additional target via external Makefile(s) Additional targets via external Makefile(s) May 19, 2014
@lgatto
Copy link
Member

lgatto commented May 19, 2014

That seems a great idea to me; I would favourably consider a pull request. Sebastian, any comments?

@sgibb
Copy link
Member

sgibb commented May 19, 2014

Hi Luca,

that is an interesting use case and a great extension.

Maybe we don't need to include this extension into the maker Makefile. What do you think about including the following lines in your ~/.makerrc?

ADDMAKEFILESDIR := ${MAKERDIR}/makefiles/
include ${ADDMAKEFILESDIR}/Makefile.*

I would definitively consider a pull request if you can convince me that .makerrc is not the right place.

Best wishes,

Sebastian

@lgatto
Copy link
Member

lgatto commented May 19, 2014

Yes, I like the .makerrc solution, as it allows to include any Makefile.

@lbraglia
Copy link
Contributor Author

Ok for the makerrc solution.. i' m working on it asap (right now i don't have a www-connected pc here). Bye, luca

@lbraglia
Copy link
Contributor Author

i've tried adding that 2 lines to makerrc (with unchanged Makefile) but it does not work for me (eg additional targets putted in makefiles dir are not available ) i've searched for unallowed recursive includeing in make, but that seems not to be the case. Maybe i'm missing something, but can you reproduce it?

@sgibb
Copy link
Member

sgibb commented May 20, 2014

Do you really use ~/.makerrc (not ${MAKERDIR}/.makerrc)? Because these two lines in my ~/.makerrc do exactly what they should do:

~/.makerrc:

ADDMAKEFILESDIR := ${MAKERDIR}/makefiles/
include ${ADDMAKEFILESDIR}/Makefile.*

${MAKERDIR}/makefiles/Makefile.foo:

foo:
        @echo bar

Example run:

> make PKG=cleaver foo
bar

@lbraglia
Copy link
Contributor Author

Yes i was changing ${MAKERDIR}/.makerrc. After a local copy refresh (to be like the original) I did the following but still I can't use it, any hint what i am doing wrong?

l@np350v5c:~/src/rpkg$ ls -a maker
.  ..  .git  include  LICENSE  Makefile  makefiles  .makerrc  README.md
l@np350v5c:~/src/rpkg$ cat .makerrc 
ADDMAKEFILESDIR := ${MAKERDIR}/makefiles/
include ${ADDMAKEFILESDIR}/Makefile.*
l@np350v5c:~/src/rpkg$ cat maker/.makerrc 
## configuration Makefile for maker

## don't build vignettes
VIG  := 0
## always use --as-cran
CRAN := 1
## specify output format for time (needs GNU time)
## see "man time" for details
# TIMEFORMAT := -f "time: %e"
l@np350v5c:~/src/rpkg$ cat maker/makefiles/Makefile.foo 
foo:
    @echo bar
l@np350v5c:~/src/rpkg$ make PKG=cleaver foo
make: ***  Nessuna regola per generare l'obiettivo "foo".  Arresto.
l@np350v5c:~/src/rpkg$ cd maker/
l@np350v5c:~/src/rpkg/maker$ git status 
Sul branch master
Your branch is up-to-date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    makefiles/

nothing added to commit but untracked files present (use "git add" to track)

@sgibb
Copy link
Member

sgibb commented May 20, 2014

The .makerrc with the following to lines:

ADDMAKEFILESDIR := ${MAKERDIR}/makefiles/
include ${ADDMAKEFILESDIR}/Makefile.*

must be in your home directory (~/.makerrc), e.g.: /home/lbraglia/.makerrc.

@lbraglia
Copy link
Contributor Author

lol, that was a quite stupid error :) ! thanks. bye, Luca

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