Skip to content

grammarjs/makefile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Makefiles have a very strange grammar, seemingly because it evolved over time as people ran into new use cases they'd like to support. Maybe some day we can create a better make.

One advantage make has is the ability to do parallel builds.

Resources

Commas and unmatched parentheses or braces cannot appear in the text of an argument as written; leading spaces cannot appear in the text of the first argument as written. These characters can be put into the argument value by variable substitution. First define variables comma and space whose values are isolated comma and space characters, then substitute these variables where such characters are wanted, like this:

 comma:= ,
 empty:=
 space:= $(empty) $(empty)
 foo:= a b c
 bar:= $(subst $(space),$(comma),$(foo))
 # bar is now `a,b,c'.

$(patsubst %.c,%.o,$(wildcard *.c))
$(wildcard *.c)
objects := $(patsubst %.c,%.o,$(wildcard *.c))
mk_temp.dll: mk_temp.c
    $(CC) -shared -o $ $< -lgnumake-1
all:
         @echo Temporary file: $(mk-temp tmpfile.)

To ignore errors in a recipe line, write a ‘-’ at the beginning of the line's text (after the initial tab). The ‘-’ is discarded before the line is passed to the shell for execution.

clean:
    -rm -f *.o

 files = foo.elc bar.o lose.o
 
 $(filter %.o,$(files)): %.o: %.c
         $(CC) -c $(CFLAGS) $< -o $@
 $(filter %.elc,$(files)): %.elc: %.el
         emacs -f batch-byte-compile $<

 ifeq (0,${MAKELEVEL})
 whoami    := $(shell whoami)
 host-type := $(shell arch)
 MAKE := ${MAKE} host-type=${host-type} whoami=${whoami}
 endif
${subdirs}:
    ${MAKE} -C $@ all

About

Makefile Language Grammar.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published