nt

simple note taker
git clone git://edryd.org/nt
Log | Files | Refs | LICENSE

Makefile (1881B)


      1 # nt - simple note taker
      2 # See LICENSE file for copyright and license details.
      3 
      4 include config.mk
      5 
      6 EXE = nt
      7 SRC = $(wildcard *.c)
      8 OBJ = $(SRC:.c=.o)
      9 
     10 all: options $(EXE)
     11 
     12 options:
     13 	@echo $(EXE) build options:
     14 	@echo "CFLAGS  = $(CFLAGS)"
     15 	@echo "LDFLAGS = $(LDFLAGS)"
     16 
     17 .o:
     18 	@echo $(LD) $@
     19 	@$(LD) -o $@ $< $(LDFLAGS)
     20 
     21 .c.o:
     22 	@echo $(CC) $<
     23 	@$(CC) -c -o $@ $< $(CFLAGS)
     24 
     25 ${OBJ}: config.h config.mk
     26 
     27 config.h:
     28 	@echo creating $@ from config.def.h
     29 	@cp config.def.h $@
     30 
     31 $(EXE): $(OBJ)
     32 	@echo $(CC) -o $@
     33 	@$(CC) -o $@ $(OBJ) $(LDFLAGS)
     34 
     35 clean:
     36 	@echo -n cleaning ...
     37 	@rm -f $(OBJ) $(EXE)
     38 	@echo \ done
     39 
     40 install: all
     41 	@echo -n installing $(EXE) to $(DESTDIR)$(PREFIX)/bin ...
     42 	@mkdir -p $(DESTDIR)$(PREFIX)/bin
     43 	@cp -f $(EXE) $(DESTDIR)$(PREFIX)/bin
     44 	@chmod 755 $(DESTDIR)$(PREFIX)/bin/$(EXE)
     45 	@echo \ done
     46 	@echo -n installing dmenu_$(EXE) to $(DESTDIR)$(PREFIX)/bin ...
     47 	@cp -f dmenu_$(EXE) $(DESTDIR)$(PREFIX)/bin
     48 	@echo \ done
     49 	@echo -n installing manual page to $(DESTDIR)$(MANPREFIX)/man1 ...
     50 	@mkdir -p $(DESTDIR)$(MANPREFIX)/man1
     51 	@sed "s/VERSION/$(VERSION)/g" < $(EXE).1 > $(DESTDIR)$(MANPREFIX)/man1/$(EXE).1
     52 	@chmod 644 $(DESTDIR)$(MANPREFIX)/man1/$(EXE).1
     53 	@echo \ done
     54 
     55 uninstall:
     56 	@echo -n removing $(EXE) from $(DESTDIR)$(PREFIX)/bin ...
     57 	@rm -f $(DESTDIR)$(PREFIX)/bin/$(EXE)
     58 	@echo \ done
     59 	@echo -n removing dmenu_$(EXE) file from $(DESTDIR)$(PREFIX)/bin ...
     60 	@rm -f $(DESTDIR)$(PREFIX)/bin/dmenu_$(EXE)
     61 	@echo \ done
     62 	@echo -n removing manual page from $(DESTDIR)$(MANPREFIX)/man1 ...
     63 	@rm -f $(DESTDIR)$(MANPREFIX)/man1/$(EXE).1
     64 	@echo \ done
     65 
     66 man:
     67 	@echo -n updating man page $(EXE).1 ...
     68 	@cat README.md | sed "s/# $(EXE)/# $(EXE) 1\n\n##NAME\n\n$(EXE) /" | \
     69 		md2man-roff | sed "s/\\[la\]/\</" | sed "s/\\[ra\]/\>/" > $(EXE).1
     70 	@echo \ done
     71 
     72 test: $(EXE)
     73 	@rm -f todo list
     74 	@clitest --prefix tab README.md
     75 
     76 .PHONY: all options clean install uninstall man test