sukamu I have written a blog post in which I explain the basic usage of the BSD Make framework for building software, explaining how to write a basic bmake Makefile to more advanced subjects such as adding compile-time options https://suragu.net/tech_posts/bsd_make.html
JuvenalUrbino Interesting post; thanks for sharing. Few observations: I wouldn't forcibly set the compiler to a binary named cc for a a various number of reasons, which would probably become self-evident if you were compiling the same package on different systems. Better to use CC?= cc instead. gmake doesn't need a .c.o suffix rule, it's built-in. if you use pkg-config on a system different from *BSD (so possibly on a pkgsrc instance), then it's better to specify the absolute path (as ${PREFIX}/bin/pkg-config), to prevent bmake from invoking the wrong binary.
rvp JuvenalUrbino Better to use CC?= cc instead. True. But, you can still override CC on the command line: Makefile CC= cc all: @echo ${CC} $ make; make CC='hello world' cc hello world $ The ?= assignment enables overriding via environment variables: env CC=gcc make ...