sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

Makefile (1128B)


      1 # sacc: saccomys gopher client
      2 # See LICENSE file for copyright and license details.
      3 .POSIX:
      4 
      5 include config.mk
      6 
      7 BIN = sacc
      8 MAN = $(BIN).1
      9 OBJ = $(BIN:=.o) ui_$(UI).o io_$(IO).o
     10 
     11 GETVER = $$(git rev-parse --is-inside-work-tree >/dev/null 2>&1 \
     12 	&& git describe --tags \
     13 	|| echo $(DEFVERSION))
     14 
     15 all: $(BIN)
     16 
     17 config.h:
     18 	cp config.def.h config.h
     19 
     20 version.h: .git/refs/heads/
     21 	printf '#define VERSION "%s"\n' "$(GETVER)" > $@
     22 
     23 $(BIN): $(OBJ)
     24 	$(CC) $(SACCLDFLAGS) -o $@ $(OBJ) $(IOLIBS) $(LIBS)
     25 
     26 $(OBJ): config.mk common.h
     27 sacc.o: config.h version.h
     28 ui_ti.o: config.h
     29 io_$(IO).o: io.h
     30 
     31 clean:
     32 	rm -f $(BIN) $(OBJ) version.h
     33 
     34 install: $(BIN)
     35 	mkdir -p $(DESTDIR)$(PREFIX)/bin/
     36 	cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin/
     37 	chmod 555 $(DESTDIR)$(PREFIX)/bin/$(BIN)
     38 	mkdir -p $(DESTDIR)$(MANDIR)
     39 	sed -e "s/%VERSION%/$(GETVER)/" $(MAN) > $(DESTDIR)$(MANDIR)/$(MAN)
     40 
     41 uninstall:
     42 	rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) $(DESTDIR)$(MANDIR)/$(MAN)
     43 
     44 # Stock FLAGS
     45 SACCCFLAGS = $(OSCFLAGS) \
     46              $(IOCFLAGS) \
     47              $(CFLAGS) \
     48 
     49 SACCLDFLAGS = $(OSLDFLAGS) \
     50 	      $(LDFLAGS) \
     51 
     52 .git/refs/heads/:
     53 
     54 .c.o:
     55 	$(CC) $(SACCCFLAGS) -c $<