Skip to content

Instantly share code, notes, and snippets.

@sortie
Last active August 29, 2015 14:22
Show Gist options
  • Save sortie/823975b7e70d5decb6f4 to your computer and use it in GitHub Desktop.
Save sortie/823975b7e70d5decb6f4 to your computer and use it in GitHub Desktop.
Sortix make TIXmakefile
.include <sys.mk> # Builtin variables and rules. (Included automatically)
.include <dirs.mk> # Standard direrctory variables.
SHAREMKDIR ?= $(DATADIR)/mk
CPPFLAGS += -DVERSIONSTR=\"$(VERSION)\" -DSHAREMKDIR=\"$(SHAREMKDIR)\" -D_GNU_SOURCE
PROGRAM = make
OBJS=\
data.o \
disambiguate.o \
execute.o \
import.o \
make.o \
rule.o \
signal.o \
util.o \
variable.o \
.PHONY: all clean install install-bin install-mk
all: $(PROGRAM)
.SUFFIXES: .c .o
.c.o:
$(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) -MD -c $< -o $@
$(PROGRAM): $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
install: install-bin install-mk
install-bin: all
mkdir -p $(DESTDIR)$(BINDIR)
install $(PROGRAM) $(DESTDIR)$(BINDIR)
install-mk:
mkdir -p $(DESTDIR)$(SHAREMKDIR)
cp *.mk -t $(DESTDIR)$(SHAREMKDIR)
clean:
rm -f $(PROGRAM) $(OBJS) *.o *.d
# TODO: Implement for loops.
#.for DEP in $(OBJS:.o=.d)
#.tryinclude "$(DEP)"
#.endfor
.tryinclude "data.d"
.tryinclude "disambiguate.d"
.tryinclude "execute.d"
.tryinclude "import.d"
.tryinclude "make.d"
.tryinclude "rule.d"
.tryinclude "signal.d"
.tryinclude "util.d"
.tryinclude "variable.d"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment