2016-01-03 06:39:27 +03:00
|
|
|
TARGET = chg
|
2017-01-02 17:57:14 +03:00
|
|
|
SRCS = chg.c hgclient.c procutil.c util.c
|
2016-01-03 06:39:27 +03:00
|
|
|
OBJS = $(SRCS:.c=.o)
|
|
|
|
|
|
|
|
CFLAGS ?= -O2 -Wall -Wextra -pedantic -g
|
2017-08-07 14:40:36 +03:00
|
|
|
CPPFLAGS ?= -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
|
2016-01-03 06:39:27 +03:00
|
|
|
override CFLAGS += -std=gnu99
|
2016-03-21 01:43:20 +03:00
|
|
|
ifdef HGPATH
|
|
|
|
override CPPFLAGS += -DHGPATH=\"$(HGPATH)\"
|
|
|
|
endif
|
2016-01-03 06:39:27 +03:00
|
|
|
|
|
|
|
DESTDIR =
|
|
|
|
PREFIX = /usr/local
|
|
|
|
MANDIR = $(PREFIX)/share/man/man1
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(TARGET): $(OBJS)
|
|
|
|
$(CC) $(LDFLAGS) -o $@ $(OBJS)
|
|
|
|
|
2017-01-02 17:57:14 +03:00
|
|
|
chg.o: hgclient.h procutil.h util.h
|
2017-01-10 01:59:03 +03:00
|
|
|
hgclient.o: hgclient.h procutil.h util.h
|
2017-01-02 17:57:14 +03:00
|
|
|
procutil.o: procutil.h util.h
|
2016-01-03 06:39:27 +03:00
|
|
|
util.o: util.h
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: $(TARGET)
|
2017-10-11 03:06:12 +03:00
|
|
|
install -d "$(DESTDIR)$(PREFIX)"/bin
|
|
|
|
install -m 755 "$(TARGET)" "$(DESTDIR)$(PREFIX)"/bin
|
|
|
|
install -d "$(DESTDIR)$(MANDIR)"
|
|
|
|
install -m 644 chg.1 "$(DESTDIR)$(MANDIR)"
|
2016-01-03 06:39:27 +03:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
$(RM) $(OBJS)
|
|
|
|
|
|
|
|
.PHONY: distclean
|
|
|
|
distclean:
|
|
|
|
$(RM) $(OBJS) $(TARGET)
|