Makefile (1195B)
1 PREFIX ?= /usr/local 2 3 # I'm assuming most Linux systems have the "new" statx call now, 4 # https://www.man7.org/linux/man-pages/man2/statx.2.html 5 # but if you're compiling on Linux and get errors about statx 6 # set HAVE_STATX = 0 7 HAVE_STATX = 1 8 9 all: libsfakeroot.so sfakeroot 10 11 CC=gcc 12 CFLAGS=-Wall -Wextra -pedantic -std=c99 -D_DEFAULT_SOURCE -DSFAKEROOT_LIBDIR=\"$(DESTDIR)$(PREFIX)/lib\" -D_GNU_SOURCE -DHAVE_STATX=$(HAVE_STATX) -g 13 LDFLAGS=-L . 14 15 libsfakeroot.o: libsfakeroot.c 16 $(CC) -c -fPIC $(CFLAGS) -o $@ libsfakeroot.c 17 18 strlcpy.o: strlcpy.c 19 $(CC) -c -fPIC $(CFLAGS) -o $@ strlcpy.c 20 21 libsfakeroot.so: libsfakeroot.o strlcpy.o 22 $(CC) -fPIC $(CFLAGS) $(LDFLAGS) -shared -o $@ libsfakeroot.o strlcpy.o 23 24 sfakeroot: sfakeroot.o strlcpy.o 25 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ sfakeroot.o strlcpy.o 26 27 sfakeroot.o: sfakeroot.c sfakeroot.h 28 29 install: 30 install sfakeroot $(DESTDIR)$(PREFIX)/bin 31 install libsfakeroot.so $(DESTDIR)$(PREFIX)/lib 32 install *.1 $(DESTDIR)$(PREFIX)/man/man1/ 33 34 uninstall: 35 rm -f $(DESTDIR)$(PREFIX)/bin/sfakeroot 36 rm -f $(DESTDIR)$(PREFIX)/lib/libsfakeroot.so 37 rm -f $(DESTDIR)$(PREFIX)/man/man1/sfakeroot.1 38 39 clean: 40 rm -f *.o *.so sfakeroot 41 42 .PHONY: all clean install uninstall