summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile50
1 files changed, 50 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..3210093
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,50 @@
+CC ?= cc
+CFLAGS ?= -O2 -g
+CFLAGS += -Wall
+LDFLAGS ?=
+
+PROG = ftp
+SRCS = cmds.c cmdtab.c complete.c cookie.c domacro.c fetch.c ftp.c \
+	list.c main.c ruserpass.c small.c stringlist.c util.c compat.c
+
+ifndef NOSSL
+SRCS += tls_compat.c
+CFLAGS += -DNOSSL=0
+LDFLAGS += -lssl -lcrypto
+else
+CFLAGS += -DNOSSL=1
+endif
+
+ifndef SMALL
+CFLAGS += -DSMALL=0
+ifneq ($(shell pkg-config --exists libedit && echo yes),)
+CFLAGS += $(shell pkg-config --cflags libedit)
+LDFLAGS += $(shell pkg-config --libs libedit)
+else
+LDFLAGS += -ledit
+endif
+ifneq ($(shell uname),Darwin)
+LDFLAGS += -lcurses
+endif
+else
+CFLAGS += -DSMALL=1
+endif
+
+OBJS = $(SRCS:.c=.o)
+
+all: $(PROG)
+
+$(PROG): $(OBJS)
+	$(CC) $(LDFLAGS) -o $(PROG) $(OBJS)
+
+%.o: %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+	rm -f $(OBJS) $(PROG)
+
+install: $(PROG)
+	install -d $(DESTDIR)/usr/bin
+	install -m 755 $(PROG) $(DESTDIR)/usr/bin/
+
+.PHONY: all clean install
\ No newline at end of file