OS := $(shell uname -s)
ifeq ($(OS), FreeBSD)
CC=cc
CFLAGS=-I/usr/local/include -I../../deps/ -I../../deps/ftplib-4.0-1/src
LDFLAGS=-L/usr/local/lib
endif
ifeq ($(OS), DragonFly)
ifeq ($(OS), NetBSD)
LDFLAGS=-R/usr/pkg/lib -L/usr/pkg/lib
ifeq ($(OS), OpenBSD)
ifeq ($(OS), Linux)
CC=gcc
LDFLAGS=
ifeq ($(OS), Darwin)
ifeq ($(OS), SunOS)
LDFLAGS=-lsocket -lnsl -lresolv
DEPS = mnetftpc.c
LIBFTP = ../../deps/ftplib-4.0-1/src/libftp.a
OBJ = mnetftpc.o
all: mnetftpc
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
$(LIBFTP):
cd ../../deps/ftplib-4.0-1/src && $(MAKE) libftp.a
mnetftpc: $(OBJ) $(LIBFTP)
$(CC) -o mnetftpc $^ -L/usr/local/lib $(LDFLAGS)
.PHONY: clean
clean:
rm -f $(OBJ) mnetftpc