blob: 21817ea92830fb3d27fe0d1b28aeeaea1d430189 [file] [log] [blame]
PKGNAME = @PROJECTNAME@
TARGET = @PROJECTNAME@.la
# Various configurable paths (remember to edit Makefile.in, not Makefile)
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
mandir = @mandir@
libtool = @libtool@
CC = @CC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LIBS = @LIBS@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBTOOL = $(libtool) --tag=CC --quiet
NETOPEER_MANAGER = @NETOPEER_MANAGER@
NETOPEER_DIR = @NETOPEER_DIR@
MODEL = voltha.yin \
voltha-config.rng \
voltha-gdefs-config.rng \
voltha-schematron.xsl
SRCS = @PROJECTNAME@.c
OBJDIR = .obj
LOBJS = $(SRCS:%.c=$(OBJDIR)/%.lo)
all: $(TARGET)
$(TARGET): $(LOBJS)
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS) -avoid-version -module -shared -export-dynamic --mode=link -o $@ $^ -rpath $(libdir)
$(OBJDIR)/%.lo: %.c
@[ -d $$(dirname $@) ] || \
(mkdir -p $$(dirname $@))
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -shared -c $< -o $@
.PHONY: install
install: $(TARGET)
$(INSTALL) -m 775 -d $(DESTDIR)/$(libdir)
$(LIBTOOL) --mode=install cp $(TARGET) $(DESTDIR)/$(libdir)/;
$(INSTALL) -d $(NETOPEER_DIR)/voltha/
@for i in $(MODEL); do \
$(INSTALL_DATA) -m 600 $$i $(NETOPEER_DIR)/$(PKGNAME)/; \
done
if test -n "$(NETOPEER_MANAGER)"; then \
if test -n "`$(NETOPEER_MANAGER) list | grep "^$(PKGNAME) ("`"; then \
$(NETOPEER_MANAGER) rm --name $(PKGNAME); \
fi; \
$(NETOPEER_MANAGER) add --name $(PKGNAME) \
--model $(NETOPEER_DIR)/$(PKGNAME)/$(PKGNAME).yin \
--transapi $(DESTDIR)/$(libdir)/$(PKGNAME).so \
--datastore $(NETOPEER_DIR)/$(PKGNAME)/datastore.xml; \
fi
.PHONY: uninstall
uninstall:
$(LIBTOOL) --mode=uninstall rm -rf $(DESTDIR)/$(libdir)/$(TARGET);
rm -rf $(NETOPEER_DIR)/$(PKGNAME)/
if test -n "$(NETOPEER_MANAGER)"; then \
if test -n "`$(NETOPEER_MANAGER) list | grep "^$(PKGNAME) ("`"; then \
$(NETOPEER_MANAGER) rm --name $(PKGNAME); \
fi; \
fi
.PHONY: clean
clean:
$(LIBTOOL) --mode clean rm -f $(LOBJS)
$(LIBTOOL) --mode clean rm -f $(TARGET)
rm -rf $(TARGET) $(OBJDIR)