
#############################################
# EXAMPLE MAKEFILE TO CREATE A OLSRD PLUGIN #
#############################################

#Alter this file to fit your needs

CC ?= gcc
NAME ?= olsrd_secure.so.0.2
INSTALL_PREFIX ?=
LIBDIR ?= $(INSTALL_PREFIX)/usr/lib
# -fPIC creates position independent code
CFLAGS ?= -Wall -fPIC -g #-DDEBUG# Uncomment -g for debugging
LIBS ?= -lc -lssl -lcrypto -lm

#Sourcefiles
#add yours here
SRCS=	src/olsrd_plugin.c src/olsrd_secure.c

#Objectfiles
#add yours here
OBJS=	src/olsrd_plugin.o src/olsrd_secure.o

#Headerfiles
#add yours here
HDRS=	src/olsrd_plugin.h src/olsrd_secure.h

# -Wl passes options to the linker(-soname,....)
# Use -lc to link it against C library
# not 100% sure if this is neccesary

all: plugin


plugin: $(OBJS)
	$(CC) -g -shared -Wl,-soname,$(NAME) \
	-o $(NAME) $(OBJS) $(LIBS)


install:
	install -D -m 755 $(NAME) $(LIBDIR)/$(NAME)
	/sbin/ldconfig -n $(LIBDIR)

clean:
	rm -f $(OBJS)
