Skip to content

nilsrennebarth/minmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Minmake

A minimal make system to use with GNU make and gcc

Features

The make system uses GNU make's (and GCC's) features to create a build system with the following features:

  • Recursive builds
  • Common options (compile flags, defines, ...) can be set at the root of the project
  • Various levels of verbosity:
    • silent, no output except errors
    • quiet, one-line summaries of what gets built (default)
    • verbose, show the full commands like make
  • Support a pristine source build where all generated files are created outside of the source tree.
  • Completely automated generation of all C source dependencies.
  • Support building of static and dynamic libraries, plugins and normal programs.
  • Small Makefiles with a minimum of boilerplate.
  • Combine the convenience of running make locally in a subdirectory with the advantages of a centralized build system.

minmake makes extensive use of GNU make and gcc specific features and will be unlikely to work with something else. It requires at least make 3.81

For documentation see the user manual

There is also a hacking howto that is supposed to explain minmakes internal workings.

Example

To give you an idea, how a minmake project will look like, assume a subdirectory lib, containing a library to be built, and a subdir src containing a program that wraps the library for the commandline.

Toplevel Makefile

# minmake infrastructure, toplevel boilerplate
PHONY := _all
_all: all
MM-sysdir:=$(shell pwd)/scripts
$(MM-sysdir)/toplevel-init.include: ;
include $(MM-sysdir)/toplevel-init.include


GENERIC_CFLAGS := -Werror -Wall -O2 -g
DEFINES := -D_GNU_SOURCE -DDEBUG -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
INCLUDES := -I /usr/include/glib-2.0
GENERIC_LDFLAGS := -g -Wl,--as-needed

subdirs := lib src
src: lib


# minmake infrastructure, toplevel footer
$(MM-sysdir)/toplevel-exit.include: ;
include $(MM-sysdir)/toplevel-exit.include

lib/Makefile

Dynamic-Libs := squilch

squilch-Objects := sq1.o sq2.o utils.o
squilch-Headers := squilch.h

LDLIBS += -lglib-2.0

sq2.o: DEFINES += -DWANT_SSL

src/Makefile

C-Programs := squilch

squilch-Objects := squilch.o cmdline.o loop.o

squilch: LOADLIBES := -L $(PROJECT_ROOT)/lib
squilch: LDLIBS += -lssl

Thanks

Thanks to the designers of the the Linux Kernel build system, which is where I took the basic ideas from.

About

A minimal make system to use with GNU make and gcc

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published