blob: 21817ea92830fb3d27fe0d1b28aeeaea1d430189 [file] [log] [blame]
Stephane Barbarie14088962017-06-01 16:56:55 -04001PKGNAME = @PROJECTNAME@
2TARGET = @PROJECTNAME@.la
3
4# Various configurable paths (remember to edit Makefile.in, not Makefile)
5prefix = @prefix@
6exec_prefix = @exec_prefix@
7datarootdir = @datarootdir@
8datadir = @datadir@
9bindir = @bindir@
10includedir = @includedir@
11libdir = @libdir@
12mandir = @mandir@
13libtool = @libtool@
14
15CC = @CC@
16INSTALL = @INSTALL@
17INSTALL_PROGRAM = @INSTALL_PROGRAM@
18INSTALL_DATA = @INSTALL_DATA@
19LIBS = @LIBS@
20CFLAGS = @CFLAGS@
21CPPFLAGS = @CPPFLAGS@
22LDFLAGS = @LDFLAGS@
23LIBTOOL = $(libtool) --tag=CC --quiet
24
25NETOPEER_MANAGER = @NETOPEER_MANAGER@
26NETOPEER_DIR = @NETOPEER_DIR@
27
28MODEL = voltha.yin \
29 voltha-config.rng \
30 voltha-gdefs-config.rng \
31 voltha-schematron.xsl
32
33SRCS = @PROJECTNAME@.c
34OBJDIR = .obj
35LOBJS = $(SRCS:%.c=$(OBJDIR)/%.lo)
36
37all: $(TARGET)
38
39$(TARGET): $(LOBJS)
40 $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS) -avoid-version -module -shared -export-dynamic --mode=link -o $@ $^ -rpath $(libdir)
41
42$(OBJDIR)/%.lo: %.c
43 @[ -d $$(dirname $@) ] || \
44 (mkdir -p $$(dirname $@))
45 $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -shared -c $< -o $@
46
47.PHONY: install
48install: $(TARGET)
49 $(INSTALL) -m 775 -d $(DESTDIR)/$(libdir)
50 $(LIBTOOL) --mode=install cp $(TARGET) $(DESTDIR)/$(libdir)/;
51 $(INSTALL) -d $(NETOPEER_DIR)/voltha/
52 @for i in $(MODEL); do \
53 $(INSTALL_DATA) -m 600 $$i $(NETOPEER_DIR)/$(PKGNAME)/; \
54 done
55 if test -n "$(NETOPEER_MANAGER)"; then \
56 if test -n "`$(NETOPEER_MANAGER) list | grep "^$(PKGNAME) ("`"; then \
57 $(NETOPEER_MANAGER) rm --name $(PKGNAME); \
58 fi; \
59 $(NETOPEER_MANAGER) add --name $(PKGNAME) \
60 --model $(NETOPEER_DIR)/$(PKGNAME)/$(PKGNAME).yin \
61 --transapi $(DESTDIR)/$(libdir)/$(PKGNAME).so \
62 --datastore $(NETOPEER_DIR)/$(PKGNAME)/datastore.xml; \
63 fi
64
65.PHONY: uninstall
66uninstall:
67 $(LIBTOOL) --mode=uninstall rm -rf $(DESTDIR)/$(libdir)/$(TARGET);
68 rm -rf $(NETOPEER_DIR)/$(PKGNAME)/
69 if test -n "$(NETOPEER_MANAGER)"; then \
70 if test -n "`$(NETOPEER_MANAGER) list | grep "^$(PKGNAME) ("`"; then \
71 $(NETOPEER_MANAGER) rm --name $(PKGNAME); \
72 fi; \
73 fi
74
75.PHONY: clean
76clean:
77 $(LIBTOOL) --mode clean rm -f $(LOBJS)
78 $(LIBTOOL) --mode clean rm -f $(TARGET)
79 rm -rf $(TARGET) $(OBJDIR)