Coder Social home page Coder Social logo

helm-make's Introduction

Description

A call to helm-make will give you a helm selection of this directory Makefile's targets. Selecting a target will call compile on it. You can cancel as usual with C-g. Support is provided for the various flavors of Make tools, as well as the Ninja build tool.

Install

Just get it from MELPA.

The functions that this package provides are auto-loaded, so no additional setup is required. Unless you want to bind the functions to a key.

Additional stuff

helm-make-do-save

If this is set to t, the currently visited files from Makefile's directory will be saved.

helm-make-projectile

This is a helm-make called with (projectile-project-root) as base directory.

helm-make-list-target-method

What method should be used to parse the Makefile. The default value is default, which is a pure elisp solution, but falls a bit short when the Makefile includes other Makefile's. The second option is qp, it is much more accurate, as it uses the database produced by make to extract the targets. But could be a bit slower when the database produced by make is large.

helm-make-build-dir

An additional directory, relative to projectile-project-root, where helm-make-projectile will search for a valid Makefile. A valid Makefile is one that GNU make looks after, i.e. the name of the Makefile must be one of Makefile, makefile or GNUmakefile to be valid.

helm-make-sort-targets

If this is set to t, sort the targets before calling the completion method. By default it is set to nil, if you are setting it to t, and you encounter longer delays before the targets are displayed, try to set this back to nil. This, however, might only be the case, if the Makefile contains thousand of targets.

helm-make-cache-targets

If this is set to t, cache the targets. Next time when you call helm-make(-projectile) for the same Makefile, and the modification time of the Makefile has not changed meanwhile, reuse the cached targets. It is set to nil by default.

helm-make-executable

You can customize executable of make command by changing this variable. Helpful for implementing remote compiling.

helm-make-ninja-executable

You can customize executable of ninja command by changing this variable. Helpful for implementing remote compiling.

helm-make-arguments

Customizes arguments which are passed to the make executable when building. To include the universal argument, use %d. Default is -j%d.

helm-make-named-buffer

When setting helm-make-named-buffer to t all make buffers will be named based on their make target and default-directory. e.g. *compilation in ~/emacs (all)* for make all in /home/USER/emacs. This is useful if you want to run multiple compilations at the same time.

helm-make-niceness

When set to a non-zero value, invocations of make or ninja will run at this niceness level. Default is 0, i.e. don't nice make commands.

helm-make-comint

When setting helm-make-comint to t helm-make will use Comint mode instead of Compilation mode. This is useful if you want to interact with the make buffer.

helm-make-fuzzy-matching

When this variable is non-nil, fuzzy matching will be enabled helm make targets buffer.

helm-make-nproc

Number passed to the '-j' flag.

When this variable is set to 0, we try to automatically retrieve available number of processing units using helm--make-get-nproc.

Regardless of the value of this variable, it can be bypassed by passing an universal prefix to helm-make or helm-make-projectile.

helm-make's People

Contributors

abo-abo avatar alvesbm avatar cslux avatar edvorg avatar eklitzke avatar kwrooijen avatar lszekeres avatar purcell avatar randomphrase avatar syohex avatar tommy-u avatar wb-towa avatar wsprent avatar xuchunyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

helm-make's Issues

build targets not shown

When I call helm-make the helm buffer appears, but no build targets are shown.
I've tried reinstalling both helm and helm-make but neither seems to fix the issue.
This is the case when I'm calling helm-make from a directory with a makefile in it and when I call helm-make-projectile.

Edit: Running helm-make-20190630.1606 on emacs 26.2.

Waf Support

Hi abo-abo,

My colleagues and I use waf (https://waf.io/book), which is a python based build system inspired by scons. I see that helm-make currently supports ninja in addition to make, and in my fork I've followed that example to implement waf support as well. Before I polish it up I figured I'd ask if you'd be interested in merging a PR that does this, given that it'll bloat the implementation somewhat:
bhipple@0957900

If so I'll polish it up, update the documentation, and send a PR your way; if not I'm happy maintaining a private fork as well.

`helm-make-named-buffer` with Projectile project root

helm-make-named-buffer presently keeps compilations of different Make targets in separate buffers. However, assuming I'm using it correctly, concurrent compilation of separate projects with the same target names will cause the latter Make to stop the former Make and take over its *compilation (TARGET)* buffer.

Can this be avoided if helm-make-named-buffer includes projectile-project-root in the name of the compilation buffer?

Thanks for your time -- this tool is super useful to me.

helm-multi-match does not work

Steps to reproduce:

  1. Paste this into Makefile,
    test_target:1.c clang-3.9 ./1.c -o out
  2. M-x helm-make
  3. type 'te tar'
  4. no candidates

I expect that test_target candidate will be available.

Custom makefile name?

I'm creating my own makefiles in projects already having their own. I just create them as makefile.local to avoid modifying versioned files.

I've managed to add my own name to the helm-make-makefile-names variable and it lists my own targets correctly. However, I've not been able to understand if and how can I get make to pass the -f switch to use the correct makefile.

Feature request: helm-make-select-build-dir

Multiple build directories are useful sometimes, particularly when you are testing your code with different compilers or build options. It would be great for helm-make to support efficiently switching from one build directory to another.

The way that I could see this working is that the existing helm-make-build-dir variable could be set to a list containing possible build directory names. When a buffer is loaded the equivalent buffer-local variable would be the first one selected from this list.

An interactive function would be provided to allow the user to switch to a different build directory, from the ones in the list. This would be selected using helm.

Please let me know if you think this is a worthwhile feature, and if so whether you agree on the implementation.

Certian types of targets are impossible to choose

Some types of targets are impossible to choose: something like "rpm-%".

Example of such target
rpm-%:
$(MAKE) -C rpm/ $(@:rpm-%=%)

May be it's a good idea to allow users of helm-make to write their own make target without checking of its existence in a Makefile.

Support for the include directive

I have a make file that contains a single include directive that points to another Makefile:

include bin/Makefile

Unfortunately this is not supported by helm-make. I cannot use helm-make-build-dir because make needs to be run at the root of the project.

Would it be possible to support such setting ?

helm-make does not work

Since a while back helm-make doesn't work on my machine any more. Invoking helm-make only results in the following error message:

helm--make: Invalid function: helm-build-sync-source

I'm running helm-make version 20190319.1035.

Possibility to set default target and command

I use spacemacs with helm and projectile as my C++ development environment. My typical workflow is a quite tight loop like this:

  1. Edit code
  2. Recompile target: currently_failing_test
  3. if (compiles)
    run currently_failing_test
  4. Go back to 1

For me it would be very valuable if I could run helm-make-projectile without selecting the target - it will be the same for quite some time; i.e. I could set a variable helm-make-default-target - and if that was set the target selection was bypassed. Would something like that be possible? I could have a go at implementing it myself - if there is a chance it would be merged?

Also I would like the number of cores to be set - without having to pass the numeric argument each time; my workstation has the same number of cores after all :-)

Not working with tramp

On function helm--make-construction-command the hostname is not considered on the regex

helm-make-projectile

When I call helm-make-projectile inside a directory that is not the current projectile root directory, compilation fails because it can find the Makefile wich is on the project root directory.

TRAMP prefix breaks compilation

Hi,
I'm trying to use SPC c c to compile on a remote machine using tramp mode. The problem I'm seeing is the tramp prefix /ssh:<user>@<host>: is being passed in along with the makefile directory path on the make line:

make -C /ssh:<user>@<host>:<make dir path> -j1 all

Which fails of course. Am I simply using the tool incorrectly, or could this use a fix?

To recreate:

  1. With a fresh .spacemacs, accept the defaults when prompted.
  2. Add c-c++ layer.
  3. Add the following lines to your user-config:
  (setq enable-remote-dir-locals t)
  (put 'helm-make-build-dir 'safe-local-variable 'stringp)
  1. Have a project on a remote machine with a .projectile file
  2. Have a .dir-locals.el file in the project root with the following:
((c++-mode (helm-make-build-dir . <path to makefile>)))
  1. Open a .cc file in the project and attempt SPC c c, run a target and see:
make: *** /ssh:<user>@<host>:<path to makefile>: No such file or directory.  Stop.

Fixing:
It looks like this is the line responsible for building the make command: https://github.com/abo-abo/helm-make/blob/master/helm-make.el#L344 .

Compile if Projectile Root

It would be awesome if helm-make included a projectile binding to run helm-make within the projectile project root.

'qp' target method could be dangerous! Please take note.

Using the 'qp' target method could be dangerous, as it might execute arbitrary shell or system commands in some cases. I think it is worthwile to note this in the documentation.

Take this Makefile snippet (I say it is harmless, but don't take my word for it ๐Ÿ˜„):

RR := $(shell xdg-open "https://www.youtube.com/watch?v=dQw4w9WgXcQ")

all:
    @echo "$(RR) Fooled ya! :)"

Depending on system setup, some (un)expected things could happen when selecting a make target. You have been warned ๐Ÿ˜„)

Question/Feature: Add function to retrieve available number of cores

Hey @abo-abo!

Does it makes sense to add code to helm-make to retrieve the available number of CPU cores.
Example implementation: https://nullprogram.com/blog/2015/10/14/

I actually think this feature should be part of emacs/compile.el.

Possible implementation.

  • Create a function which returns the CPU cores.
  • Create a helm-make defcustom, e.g. helm-make-njobs, which is either a number (default 1) or a function returning a number.
  • A universal prefix would overrule helm-make-njobs and is used instead.

regards,
Christian

Interest check: Ninja support?

Hi, I was just wondering if you had considered supporting the Ninja build tool? I think there's enough similarities between Ninja and Make that it might make sense - but I understand if you think otherwise.

From a brief look I think the following changes could be made to support Ninja:

  • Add a new function to generate a list of targets from a Ninja build file. Fortunately Ninja supports a -t targets option which will output the targets in an easily parseable form.
  • Minor tweaks to the command line generation (mainly avoid using -j I think)
  • Not much else, probably

I'm happy to submit a PR but just wanted to check your interest before starting work. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.