examples icon indicating copy to clipboard operation
examples copied to clipboard

Add makefile example

Open gobengo opened this issue 5 years ago • 0 comments

Overview

Demonstrate a reasonable way of using gnu make with a dfx project.

Other projects already have Makefiles, but they are quite basic.

Requirements

  • Add a new example called 'makefile'
  • In this project, the Makefile should be more advanced.
  • I should be able to run make call method={actorMethod} [arg] to create the canister, build the src code, install to cansiter, and then call the canister.
  • As much as possible, try to cache artifacts between calls using make dependencies

Considered Solutions

Just this one.

Recommended Solution

Fairly straightforward use of make, though I'm not an expert.

Considerations

It is a new example to 'maintain' over time. But it should be useful as a place to go copypasta a good starting point Makefile for any new dfx project.

  • I tested this by pasting into one of the 'hello' tutorial projects, and:
    ▶ make call method=greet ben
    dfx canister call hello greet "ben"
    ("Hello (v17), ben!")
    

If it's useful enough, maybe it even makes it into the core project scaffold's Makefile (output of dfx new).

gobengo avatar Aug 23 '20 04:08 gobengo