Makefile Best-Practices

April 30th, 2019 • 167 Words

The more projects you work on, the more streamlined your tooling gets. Hopefully. Various services using different languages have different tooling requirements, of course. A sweet Makefile can be the entry to a unified tooling interface.

As long as I can run make build deploy in a project, I’m happy. Do you a have more complex interface to deploy a dev environment? Rethink your tooling and remove obstacles for people who want to work on your project or contribute to your code.

Hide Commands

You might have noticed, make will list the invoked commands in a target per default. You can avoid this, and have a more slick output using @ in front of your commands:

greet:
  @ echo "Hi!"
# Without @
$ > make greet

echo "Hi!"
Hi!

# With @
$ > make greet

Hi!

Wildcard Targets

You can always access environment variables in a Makefile, but for composition, you may want to use wildcard targets in make files.

greet-%:
  @ echo Hi $*!
# Say Hi to Frank
$ > make greet-Frank

Hi Frank!

Foreach and Lists

Together with wildcard targets, using lists and foreach can be a powerful addition to your make toolbox:

NAMES := Anne Frank Paul

greet-%:
  @ echo Hi $*!
greet:
  @ make $(foreach NAME,$(NAMES),greet-$(NAME))
# Say Hi to everybody!
$ > make greet

Hi Anne!
Hi Frank!
Hi Paul!

I plan to write down more Best Practices soonish


  • React SPA with server-side rendering on AWS Lambda

    February 5th, 2020 • 1152 Words • EN

    React is great for creating websites and writing applications using JavaScript. But, whenever the use of React is rejected, one of the most common reasons is the lack of a simple implementation for server-side rendering (SSR). When you search on Google for this topic, you’ll find various approaches…

  • Deploy React SPA with CodePipeline and CodeBuild using AWS CDK

    January 23rd, 2020 • 748 Words • EN

    There are plenty of tools and services for continuous delivery available. Most of them are either directly built into the source code management tools you already use, or perfectly integrate with them. You might be familiar with CircleCI, Travis CI, GitLab CI, or GitHub Actions. Of course, AWS has…

  • AWS re:Invent 2019 Recap & Videos

    December 15th, 2019 • 360 Words • EN

    I was able to attend the AWS re:Invent 2019 conference. A week full of learning about current and new technologies, services, and general approaches is definitely overwhelming. There is no much content available, during the conference, and as videos and slide decks afterwards. I tried to list my…

  • CloudFormation Best-Practices

    May 1st, 2019 • 457 Words • EN

    You can find plenty of frameworks and tools to provision your AWS resources. Some of them do a great job for a specific purpose, others are more generic. Nevertheless, I do prefer to use native CloudFormation templates as much as possible. Prefix all the things Split up your CFN Stacks Nested…

  • AppSync GraphQL API with Custom Domain and CloudFormation

    April 7th, 2019 • 165 Words • EN

    With AWS AppSync, it’s easy to run your own serverless GraphQL service API. Thanks to Velocity Mapping Templates, DynamoDB, and AWS Lambda your can aim for an architecture without any maintenance at all. Getting started with AppSync is not that problem; there are tons of guides and frameworks. AWS…

  • Last Update: 2020-02-17T10:07:11.183Z
    Stresemannstraße 132, 22769 Hamburg
    +49 151 54 64 90 55
    inbox@sbstjn.com