Makefile (1699B)
1 .POSIX: 2 CC = cc 3 CFLAGS = -std=c99 -pedantic -Wall -Wextra 4 PREFIX = /usr/local 5 MANPREFIX = $(PREFIX)/share/man 6 OBJ = main.o appbuf.o editor.o file.o find.o input.o output.o row.o syntax.o term.o 7 SRC = main.c appbuf.c editor.c file.c find.c input.c output.c row.c syntax.c term.c 8 HDR = jim.h appbuf.h editor.h file.h find.h input.h output.h row.h syntax.h term.h 9 VERSION = 0.0.2 10 11 all: jim 12 13 install: jim 14 mkdir -p $(DESTDIR)$(PREFIX)/bin 15 cp -f jim $(DESTDIR)$(PREFIX)/bin 16 chmod 755 $(DESTDIR)$(PREFIX)/bin/jim 17 mkdir -p $(DESTDIR)$(MANPREFIX)/man1 18 sed "s/VERSION/$(VERSION)/g" < jim.1 > $(DESTDIR)$(MANPREFIX)/man1/jim.1 19 gzip -f $(DESTDIR)$(MANPREFIX)/man1/jim.1 20 rm -f $(DESTDIR)$(MANPREFIX)/man1/jim.1 21 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/jim.1.gz 22 23 debug: CFLAGS += -ggdb 24 debug: jim 25 26 jim: main.o appbuf.o editor.o file.o find.o input.o output.o row.o syntax.o term.o 27 $(CC) $(CFLAGS) -o jim $(OBJ) 28 29 main.o: main.c jim.h output.h term.h file.h input.h output.h 30 appbuf.o: appbuf.c appbuf.h 31 editor.o: editor.c editor.h jim.h row.h 32 file.o: file.c file.h row.h output.h input.h 33 find.o: find.c find.h output.h input.h 34 input.o: input.c input.h editor.h row.h file.h find.h output.h 35 output.o: output.c output.h jim.h appbuf.h syntax.h 36 row.o: row.c row.h 37 syntax.o: syntax.c syntax.h jim.h 38 term.o: term.c term.h jim.h output.h 39 40 clean: 41 rm -f jim $(OBJ) jim-$(VERSION).tar.gz 42 43 dist: clean 44 mkdir -p jim-${VERSION} 45 cp -R LICENSE Makefile README jim.1 ${HDR} ${SRC} jim-${VERSION} 46 tar -cf jim-${VERSION}.tar jim-${VERSION} 47 gzip jim-${VERSION}.tar 48 rm -rf jim-${VERSION} 49 50 uninstall: 51 rm -rf $(DESTDIR)$(PREFIX)/bin/jim $(DESTDIR)$(MANPREFIX)/man1/jim.1 $(DESTDIR)$(MANPREFIX)/man1/jim.1.gz