2016-05-01 12:30:50 -07:00
|
|
|
# Installation directories following GNU conventions
|
2016-09-18 20:33:29 -07:00
|
|
|
prefix ?= /usr/local
|
2016-05-01 12:30:50 -07:00
|
|
|
exec_prefix = $(prefix)
|
|
|
|
bindir = $(exec_prefix)/bin
|
|
|
|
sbindir = $(exec_prefix)/sbin
|
|
|
|
datarootdir = $(prefix)/share
|
|
|
|
datadir = $(datarootdir)
|
|
|
|
includedir = $(prefix)/include
|
|
|
|
mandir = $(datarootdir)/man
|
|
|
|
|
2016-04-15 11:02:09 -07:00
|
|
|
BIN=bin
|
|
|
|
OBJ=obj
|
|
|
|
SRC=src
|
|
|
|
|
2016-09-18 20:33:29 -07:00
|
|
|
CC ?= gcc
|
|
|
|
CFLAGS ?= -Wextra -Wall
|
2016-04-15 11:02:09 -07:00
|
|
|
|
2016-05-01 12:30:50 -07:00
|
|
|
.PHONY: all install uninstall clean
|
|
|
|
|
|
|
|
EXES = nms sneakers
|
|
|
|
all: $(EXES)
|
2016-04-18 09:00:57 -07:00
|
|
|
|
2017-01-13 12:58:05 -08:00
|
|
|
nms: $(OBJ)/libnms.o $(OBJ)/nms.o | $(BIN)
|
2017-01-08 14:22:03 -08:00
|
|
|
$(CC) $(CFLAGS) -o $(BIN)/$@ $^
|
2016-04-19 15:18:02 -07:00
|
|
|
|
2017-01-08 14:22:03 -08:00
|
|
|
sneakers: $(OBJ)/libnms.o $(OBJ)/sneakers.o | $(BIN)
|
|
|
|
$(CC) $(CFLAGS) -o $(BIN)/$@ $^
|
2016-04-15 11:02:09 -07:00
|
|
|
|
2017-01-08 14:22:03 -08:00
|
|
|
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ)
|
2016-04-27 21:51:47 -07:00
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
2016-04-19 15:18:02 -07:00
|
|
|
|
2016-04-27 21:51:47 -07:00
|
|
|
$(BIN):
|
|
|
|
mkdir $(BIN)
|
|
|
|
|
|
|
|
$(OBJ):
|
|
|
|
mkdir $(OBJ)
|
|
|
|
|
2016-04-15 11:02:09 -07:00
|
|
|
clean:
|
2016-04-27 21:51:47 -07:00
|
|
|
rm -rf $(BIN)
|
|
|
|
rm -rf $(OBJ)
|
2016-05-01 12:30:50 -07:00
|
|
|
|
|
|
|
install:
|
2016-05-20 13:13:33 -07:00
|
|
|
install -d $(DESTDIR)$(bindir)
|
|
|
|
cd $(BIN) && install $(EXES) $(DESTDIR)$(bindir)
|
2016-05-01 12:30:50 -07:00
|
|
|
|
|
|
|
uninstall:
|
2016-05-20 13:13:33 -07:00
|
|
|
for exe in $(EXES); do rm $(DESTDIR)$(bindir)/$$exe; done
|
2016-05-01 12:30:50 -07:00
|
|
|
|