ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}

AM_CPPFLAGS = \
	-std=gnu99 \
	-D_GNU_SOURCE \
	-include $(top_builddir)/config.h \
	-I$(top_srcdir) \
	-DHAVE_IPV6
	
AM_CFLAGS = \
	`pkg-config --cflags libnetaid libubus libubox json-c`
	
AM_LDFLAGS = \
	-Werror-implicit-function-declaration \
	-Wall \
	-rdynamic \
	`pkg-config --libs libnetaid libubus libubox json-c` \
	-liw \
	-lblobmsg_json -ljson_script

sbin_PROGRAMS = \
	snetaid

#snetaidlibexec_PROGRAMS = \
#snetaid-cli

snetaid_SOURCES = \
	def.h \
	server.c \
	ini.c \
	config.c \
	util.c \
	policy.c \
	iwlist.c \
	netlink_monitor.c \
	notify.c
	
#snetaid_cli_SOURCES = \
#	client.c

noinst_HEADERS = \
	def.h \
	ini.h \
	config.h \
	util.h \
	policy.h \
	iwlist.h \
	netlink_monitor.h

snetaid_CFLAGS = \
	$(AM_CFLAGS)

snetaid_LDFLAGS = \
	$(AM_LDFLAGS)

#snetaid_cli_LDFLAGS = \
#	$(AM_LDFLAGS)

# DO NOT install in /etc/local.
# /etc/network/interfaces and its subdirs belong to the network manager (ifupdown2).
# We create a specific subdir for our managed wireless profiles.
install-data-local:
	$(MKDIR_P) $(DESTDIR)/etc/network/wifi
	$(MKDIR_P) $(DESTDIR)/etc/simple-netaid
	chmod 755 $(DESTDIR)/etc/network/wifi

# Limpieza de directorios y archivos al desinstalar
uninstall-local:
	-rm -rf $(DESTDIR)/etc/network/wifi
	-rm -rf $(DESTDIR)/etc/simple-netaid
	-rm -rf $(DESTDIR)/run/snetaid

