Commit: 530526aff0ed9f29f5eafaed2da667ac5da332fb Parent: d0d828ca531b4f391f0443829aa743ad7a7c96f9 Author: 0x766F6964 Date: Sun, 3 May 2020 22:19:33 -0600 add Makefile Diffstat:
A | Makefile | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
M | TODO | | | 1 | - |
A | config.mk | | | 7 | +++++++ |
3 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile @@ -0,0 +1,38 @@ +# dir2list - generates a list of files shuffled by directory +.POSIX: + +include config.mk + +SRC = dir2list.c +OBJ = $(SRC:.c=.o) + +all: dir2list + +config.h: + cp config.def.h config.h + +.c.o: + $(CC) $(CFLAGS) -c $< + +$(OBJ): config.h + +dir2list: $(OBJ) + $(CC) -o $@ $(OBJ) $(LDFLAGS) + +clean: + rm -f *.o dir2list + +options: + @echo "CFLAGS = $(CFLAGS)" + @echo "LDFLAGS = $(LDFLAGS)" + @echo "CC = $(CC)" + +install: all + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f dir2list $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/dir2list + +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/dir2list + +.PHONY: all options clean install uninstall diff --git a/TODO b/TODO @@ -1,5 +1,4 @@ - Stop wasting PATH_MAX bytes per node - Sort Directory entries -- Makefile - FIXME note - use realloc in xstrcat instead of failing diff --git a/config.mk b/config.mk @@ -0,0 +1,7 @@ +PREFIX = /usr/local + +CPPFLAGS = -D_POSIX_C_SOURCE +CFLAGS = -O2 -std=c99 -Wall -pedantic $(CPPFLAGS) +LDFLAGS = -s -static + +CC = cc