commit 21eefc79f3bb7aa95fced595454592bdd84b55a2
parent f072280dda5c20c4e478b2b417e78d7ab679770a
Author: Pavel Renev <an2qzavok@gmail.com>
Date: Tue, 22 Sep 2020 21:16:54 +0300
straight up copy suckless.orgs Makefile layout
Diffstat:
2 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,32 +1,31 @@
-.POSIX:
+include config.mk
-PREFIX = /usr/local
-MANDIR = $(PREFIX)/share/man/man1
+SRC = pcmprint.c
+OBJ = ${SRC:.c=.o}
-BIN = pcmprint
-MAN = $(BIN).1
-OBJ = $(BIN:=.o)
+all: pcmprint
-all: $(BIN)
+.c.o:
+ ${CC} -c ${CFLAGS} $<
-$(BIN): $(OBJ)
- $(CC) $(OBJ) $(LDFLAGS) $(LIBS) -o $@
+${OBJ}:
-$(OBJ):
+pcmprint: ${OBJ}
+ ${CC} -o $@ ${OBJ} ${LDFLAGS}
-install: $(BIN)
- mkdir -p $(DESTDIR)$(PREFIX)/bin/
- cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin/
- chmod 555 $(DESTDIR)$(PREFIX)/bin/$(BIN)
- mkdir -p $(DESTDIR)$(MANDIR)
- cp -f $(MAN) $(DESTDIR)$(MANDIR)
+install: all
+ mkdir -p ${DESTDIR}${PREFIX}/bin/
+ cp -f pcmprint $(DESTDIR)${PREFIX}/bin/
+ chmod 755 ${DESTDIR}${PREFIX}/bin/pcmprint
+ mkdir -p ${DESTDIR}${MANDIR}/man1
+ cp -f pcmprint.1 ${DESTDIR)${MANDIR}/man1/pcmprint.1
+ chmod 644 ${DESTDIR}${MANPREFIX}/man1/pcmprint.1
uninstall:
- rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
- rm -f $(DESTDIR)$(MANDIR)/$(MAN)
+ rm -f ${DESTDIR}${PREFIX}/bin/pcmprint\
+ ${DESTDIR}${MANDIR}/pcmprint.1
clean:
- rm -f $(BIN) $(OBJ)
+ rm -f pcmprint ${OBJ}
-.c.o:
- $(CC) $(CFLAGS) -c $<
+.PHONY: all clean instal uninstall
diff --git a/pcmprint.c b/pcmprint.c
@@ -47,7 +47,7 @@ main(int argc, char **argv)
{
char buf[11];
int ch;
- size_t i, n, m, l, s;
+ size_t i, n, l, s;
int16_t *blk;
int32_t f, lmin, lmax, rmin,rmax;
f = 0;
@@ -56,7 +56,7 @@ main(int argc, char **argv)
case 'b':
BLKSIZE = atoi(optarg);
if (BLKSIZE <= 0){
- dprintf(2, "Error: -b too small: %d\n", BLKSIZE);
+ dprintf(2, "Error: -b too small: %ld\n", BLKSIZE);
exit(1);
}
break;