INADYN_BASE = .
SRCDIR = $(INADYN_BASE)/src
OUTDIR=bin
OUTFILE=$(OUTDIR)/inadyn

# Make command to use for dependencies
MAKECMD=gmake

COMMON_OBJ=$(OUTDIR)/base64utils.o $(OUTDIR)/dyndns.o \
	$(OUTDIR)/errorcode.o $(OUTDIR)/get_cmd.o $(OUTDIR)/http_client.o \
	$(OUTDIR)/ip.o $(OUTDIR)/main.o $(OUTDIR)/os.o $(OUTDIR)/os_psos.o \
	$(OUTDIR)/os_unix.o $(OUTDIR)/os_windows.o $(OUTDIR)/tcp.o $(OUTDIR)/inadyn_cmd.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)

COMPILE=gcc -c  -g -o "$(OUTDIR)/$(*F).o" $(CFG_INC) "$<"
LINK=gcc  -g -o "$(OUTFILE)" $(OBJ) $(CFG_LIB)

# Pattern rules
$(OUTDIR)/%.o : $(SRCDIR)/%.c
	$(COMPILE)

# Build rules
all: $(OUTFILE)

$(OUTFILE): $(OUTDIR)  $(OBJ)
	$(LINK)

$(OUTDIR):
	-mkdir -p "$(OUTDIR)"

# Rebuild this project
rebuild: cleanall all

# Clean this project
clean:
	rm -f $(OUTFILE)
	rm -f $(OBJ)

# Clean this project and all dependencies
cleanall: clean

