summaryrefslogtreecommitdiff
path: root/Makefile
blob: df6b1a43927f66ebbca97d77eb4653385c0dbfc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# See COPYING file for copyright and license details.
include config.mk

NAME = getxbook

SRC = getgbook.c
LIB = util.o

BIN = $(SRC:.c=)
OBJ = $(SRC:.c=.o) $(LIB)

all: $(BIN)

$(OBJ): util.h config.mk
$(BIN): util.a

.o:
	@echo LD $@
	@$(LD) -o $@ $< util.a $(LDFLAGS)

.c.o:
	@echo CC $<
	@$(CC) -c $(CFLAGS) $<

util.a: $(LIB)
	@echo AR $@
	@$(AR) -r -c $@ $(LIB)
	@ranlib $@

install: all
	cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin

uninstall:
	cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)

clean:
	rm -f -- $(BIN) $(OBJ) util.a

dist:
	@mkdir -p $(NAME)-$(VERSION)
	@cp $(SRC) util.h util.c Makefile config.mk COPYING $(NAME)-$(VERSION)
	@tar c $(NAME)-$(VERSION) | gzip -c > $(NAME)-$(VERSION).tar.gz
	@rm -rf $(NAME)-$(VERSION)
	@echo $(NAME)-$(VERSION).tar.gz

.PHONY: all clean install uninstall dist