e7ec1e9b9a
modified: Makefile renamed: src/main.c -> src/nms.c
49 lines
875 B
Makefile
49 lines
875 B
Makefile
# Installation directories following GNU conventions
|
|
prefix ?= /usr/local
|
|
exec_prefix = $(prefix)
|
|
bindir = $(exec_prefix)/bin
|
|
sbindir = $(exec_prefix)/sbin
|
|
datarootdir = $(prefix)/share
|
|
datadir = $(datarootdir)
|
|
includedir = $(prefix)/include
|
|
mandir = $(datarootdir)/man
|
|
|
|
BIN=bin
|
|
OBJ=obj
|
|
SRC=src
|
|
|
|
CC ?= gcc
|
|
CFLAGS ?= -Wextra -Wall
|
|
|
|
.PHONY: all install uninstall clean
|
|
|
|
EXES = nms sneakers
|
|
all: $(EXES)
|
|
|
|
nms: $(OBJ)/libnms.o $(OBJ)/nms.o | $(BIN)
|
|
$(CC) $(CFLAGS) -o $(BIN)/$@ $^
|
|
|
|
sneakers: $(OBJ)/libnms.o $(OBJ)/sneakers.o | $(BIN)
|
|
$(CC) $(CFLAGS) -o $(BIN)/$@ $^
|
|
|
|
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ)
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
$(BIN):
|
|
mkdir $(BIN)
|
|
|
|
$(OBJ):
|
|
mkdir $(OBJ)
|
|
|
|
clean:
|
|
rm -rf $(BIN)
|
|
rm -rf $(OBJ)
|
|
|
|
install:
|
|
install -d $(DESTDIR)$(bindir)
|
|
cd $(BIN) && install $(EXES) $(DESTDIR)$(bindir)
|
|
|
|
uninstall:
|
|
for exe in $(EXES); do rm $(DESTDIR)$(bindir)/$$exe; done
|
|
|