Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)E
Posts
3
Comments
501
Joined
12 mo. ago

  • This whole industry is a slow motion car crash with clowns falling out of every window.

  • If you connect a random number generator to the trigger of a gun, who is responsible?

  • A thief would make more money stealing the lockers than the phones.

  • Well spotted, thanks. I replied further down the thread to OP with another option for doing this in Make, if you'd like to spot any bugs in that one too ;)

  • Yes, I didn't notice that, I should have tested it more thoroughly!

    Make works best when there's a simple relation between target filename and the dependency filenames, and when the output filenames are known ahead of time (or are easily derived from a list of inputs).

    You can use Make to achieve what you want though, even when the relations are complex. The idiomatic pattern is to dynamically create your dependency lists and include them at runtime. Make supports this as a first-class feature and will handle re-evaluating any rules that are changed every time an included Makefile is (re-)generated.

    For example:

     
        
    SOURCE := $(wildcard source/*.md)
    SDEPS := $(SOURCE:.md=.d)
    
    include all.d
    include ${SDEPS}
    
    all.d: ${SDEPS}
    	sed -i "s/^/all: /" all.d
    
    ${SDEPS}: %.d: %.md 
    	DEST="destination/$$(basename $< | sed -E 's/^([0-9]{4})-([0-9]{2})-([0-9]{2})-(.*)\.md$$/\1\/\2\/\3\/\4.md/')"; \
    	printf "%s: $<\n" $${DEST} >$@; \
    	printf "%s " $${DEST} >>all.d
    
    %.md:
    	mkdir -p $(dir $@)
    	/bin/bash ./myscript.sh $< >$@
    
    
      

    (I've tested this one and it seems to work)

    But if you want to avoid any complex use of Make then you can push a lot of the logic into your script and then just create a timestamp file for each input as a dummy output to represent the fact that the script was run on each input. eg.

     
        
    SOURCE := $(wildcard source/*.md)
    SOURCE_TS := $(SOURCE:.md=.ts)
    
    all: ${SOURCE_TS}
    
    %.ts: %.md
    	/bin/bash ./myscript.sh $<
    	touch $@
    
      

    This is a much simpler Makefile, but now you need to create the output filename, make the output directory and redirect the script output inside the script itself. The other drawback is that it's harder to use the output file as an input to another rule. You can use the timestamp file as an input but you won't have the actual filename available to send to a command without some more scripting.

  • mental illness

  • Regardless of what power source you use, all of the power going into a datacentre comes out as heat. So even a 1GW solar plant powering an AI datacentre is putting 1GW of heat into the atmosphere.

  • Sounds like an STD.

  • 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.

  • Ask yourself why Steve Jobs didn't write a manifesto about how the smartphone would change the world.

  • Will your management of the instance be as low effort as your introductory post that you obviously didn't write yourself?

  • I see your post from piefed.social, so federation is working here. Good job.

  • These fuckers just don't know what's good for them.

  • The reason that I hate time travel stories is that they make everything you've seen up until that point, completely pointless.

    It's disrespectful to the viewers and everyone involved.

  • Bonjour Jean Bernard!

    mdr vous regardez l'éclipse solaire quoi?

  • The cloud is just somebody else's computer.

  • Open Source Storage

    Anyone heard of this company before? Their name is impossible to search for!

  • Chat, is Amazon's AI cooked?