zygo

ncurses gopher client
git clone https://hhvn.uk/zygo
git clone git://hhvn.uk/zygo
Log | Files | Refs

Makefile (1587B)


      1 # zygo/Makefile
      2 #
      3 # Copyright (c) 2022 hhvn <dev@hhvn.uk>
      4 #
      5 # Permission to use, copy, modify, and distribute this software for any
      6 # purpose with or without fee is hereby granted, provided that the above
      7 # copyright notice and this permission notice appear in all copies.
      8 #
      9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     16 
     17 PREFIX	= /usr/local
     18 BINDIR	= $(PREFIX)/bin
     19 MANDIR	= $(PREFIX)/man
     20 BIN	= zygo
     21 MAN	= zygo.1
     22 SRC	+= zygo.c
     23 OBJ	= $(SRC:.c=.o)
     24 COMMIT	= $(shell grep -oE '^.{7}' < .git/refs/heads/master)
     25 LDFLAGS = -lncursesw
     26 CFLAGS	= -DCOMMIT=\"$(COMMIT)\"
     27 
     28 include config.mk
     29 
     30 $(BIN): $(OBJ)
     31 	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJ)
     32 	@echo "---> If you see any warnings or weird things happening, read the FAQ <---"
     33 
     34 $(OBJ): Makefile config.mk zygo.h
     35 zygo.o: config.h
     36 
     37 .c.o:
     38 	$(CC) $(CFLAGS) -c $< -o $@
     39 
     40 install:
     41 	mkdir -p $(BINDIR)
     42 	install -m0755 $(BIN) $(BINDIR)/$(BIN)
     43 	mkdir -p $(MANDIR)/man1
     44 	sed "s/COMMIT/$(COMMIT)/" < $(MAN) > $(MANDIR)/man1/$(MAN)
     45 
     46 uninstall:
     47 	-rm -rf $(BINDIR)/$(BIN) $(MANDIR)/man1/$(MAN)
     48 
     49 clean:
     50 	-rm -f $(OBJ) $(BIN)
     51 
     52 config.h: config.def.h
     53 	cp config.def.h config.h
     54 
     55 .PHONY: clean install uninstall