summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile21
-rw-r--r--util.h4
2 files changed, 18 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index ff728e6..ac6b529 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,29 @@
# See COPYING file for copyright, license and warranty details.
-
include config.mk
SRC = getgbook.c
-OBJ = $(SRC:.c=.o)
+LIB = util.o
+
BIN = $(SRC:.c=)
+OBJ = $(SRC:.c=.o) $(LIB)
all: $(BIN)
-$(OBJ): util.c
+$(OBJ): util.h config.mk
+$(BIN): util.a
+
+.o:
+ @echo LD $@
+ @$(LD) -o $@ $< util.a $(LDFLAGS)
.c.o:
@echo CC $<
@$(CC) -c $(CFLAGS) $<
-getgbook: $(OBJ)
- @echo LD $@
- @$(CC) -o $@ $(OBJ) $(LDFLAGS)
+util.a: $(LIB)
+ @echo AR $@
+ @$(AR) -r -c $@ $(LIB)
+ @ranlib $@
install: all
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
@@ -25,6 +32,6 @@ uninstall:
cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
clean:
- rm -f -- $(BIN) $(OBJ)
+ rm -f -- $(BIN) $(OBJ) util.a
.PHONY: all clean install uninstall
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..541fab3
--- /dev/null
+++ b/util.h
@@ -0,0 +1,4 @@
+/* See COPYING file for copyright, license and warranty details. */
+int dial(char *host, char *port);
+int get(char *host, char *path, char **buf);
+int gettofile(char *host, char *url, char *savepath);