| 1 |
.PHONY: all clean install uninstall manpage |
| 2 |
|
| 3 |
CC = /usr/bin/gcc |
| 4 |
PKG_CONFIG ?= pkg-config |
| 5 |
CFLAGS += -std=gnu99 -lconfig -D_GNU_SOURCE -fcommon |
| 6 |
CFLAGS += `$(PKG_CONFIG) --cflags libconfig` |
| 7 |
LDLIBS += `$(PKG_CONFIG) --libs libconfig` |
| 8 |
LDFLAGS = -ltermcap -z now |
| 9 |
BIN = lsmount |
| 10 |
OBJ = lsmount.o lsmgrid.o options.o lsmcolors.o helper.o |
| 11 |
VPATH = src |
| 12 |
|
| 13 |
all: CFLAGS += -O2 -Wall -pedantic -fPIE -D_FORTIFY_SOURCE=1 |
| 14 |
all: $(BIN) |
| 15 |
|
| 16 |
debug: CFLAGS += -g -Og -DDEBUG -Werror -Wextra -pedantic -Wcast-qual -Wcast-align -Wformat -Wformat-nonliteral -Wformat-security -Winit-self -Wmissing-include-dirs -Wno-suggest-attribute=noreturn -Wno-write-strings -Wpointer-arith -Wredundant-decls -Wundef -Wpacked -Wunreachable-code -Wno-unused-parameter -Wconversion -Wshadow -Wstrict-prototypes -Wbad-function-cast -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wnested-externs |
| 17 |
debug: $(BIN) |
| 18 |
|
| 19 |
lsmount: lsmount.o lsmgrid.o options.o lsmcolors.o helper.o |
| 20 |
$(CC) -o $@ $(OBJ) $(LDLIBS) $(LDFLAGS) |
| 21 |
lsmount.o: lsmount.c lsmount.h ansicodes.h |
| 22 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 23 |
lsmgrid.o: lsmgrid.c lsmgrid.h |
| 24 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 25 |
lsmcolors.o: lsmcolors.c lsmcolors.h |
| 26 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 27 |
options.o: options.c options.h |
| 28 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 29 |
helper.o: helper.c helper.h |
| 30 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 31 |
|
| 32 |
clean: |
| 33 |
rm -f $(BIN) $(OBJ) |
| 34 |
rm -f doc/lsmount.1.gz |
| 35 |
|
| 36 |
install: lsmount manpage |
| 37 |
cp lsmount /usr/bin/$(BIN) |
| 38 |
cp share/lsmount.rc.default /etc/lsmountrc |
| 39 |
cp doc/lsmount.1.gz /usr/share/man/man1/ |
| 40 |
|
| 41 |
uninstall: |
| 42 |
rm -f /usr/bin/$(BIN) |
| 43 |
rm -f /etc/lsmountrc |
| 44 |
rm -f /usr/share/man/man1/lsmount.1.gz |
| 45 |
|
| 46 |
manpage: doc/lsmount.txt |
| 47 |
a2x -f manpage doc/lsmount.txt |
| 48 |
gzip -f doc/lsmount.1 |