• 9 Posts
  • 689 Comments
Joined 11 months ago
cake
Cake day: September 22nd, 2025

help-circle
  • Is this the whole Makefile? The default target is the first rule that appears in the file which in this case is the DESTINATION rule, so if you just type make then it should work. If make is telling you there’s no rule to make the target then you’re probably invoking something like make all and you don’t have an all target.

    When I run it your Makefile with no target, I get this error:

    $ make -f blamster.mk 
    /bin/bash ./myscript.sh source/1234-56-78-some-file-name.md > destination/SOURCE  
    /bin/sh: 1: cannot create destination/SOURCE: Directory nonexistent  
    blamster.mk:5: recipe for target 'destination/SOURCE' failed  
    make: *** [destination/SOURCE] Error 2  
    

    The following fixed Makefile works for me:

    SOURCE := $(wildcard source/*.md)  
    DESTINATION := $(foreach f,${SOURCE},destination/$(shell echo $(notdir $(f)) | sed -E 's/^([0-9]{4})-([0-9]{2})-([0-9]{2})-(.*)\.md$$/\1\/\2\/\3\/\4.md/'))  
    
    all: ${DESTINATION}  
    
    $(DESTINATION): $(SOURCE)  
    	mkdir -p $(dir $@)  
    	/bin/bash ./myscript.sh $< > $@  
    

    The things I had to change were: In the foreach you need to reference SOURCE as a variable ${SOURCE}. In your recipe you can just create the directory directly from the output filename instead of doing another regex. Lastly, to create all output files you also need to create a default target (eg. all) that depends on all of the output files.



















  • I know what the tool does, I read the webpage.

    Code coverage tools are generally specifically about test coverage, not which code actually gets executed or is unreachable.

    Code coverage tools are for whatever you want to use them for. Lots of people use them to measure test coverage, but you can also use them to measure code usage in production. There are a variety of different ways to instrument code of various different levels of invasiveness and performance impact. Even the Linux kernel has built in instrumentation for measuring code coverage (kcov).