view contrib/spcdns/Makefile @ 523:9ac53695a44d tip

Update mktplinkfw to handle more boards
author Aleksandr Rybalko <ray@ddteam.net>
date Fri, 08 Jan 2016 23:53:34 +0200
parents fee6b517c6d4
children
line wrap: on
line source

#######################################################################
#
# Copyright 2010 by Sean Conner.  All Rights Reserved.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, see <http://www.gnu.org/licenses/>.
#
######################################################################

#================================================
# Linux
#================================================

CC     = gcc -g -std=c99
CFLAGS = -Wall -Wextra -pedantic
#CFLAGS = -Os -fomit-frame-pointer -DNDEBUG
PIC    = -fpic
LFLAGS = -lm 
LUA    = /usr/local/lib/lua/5.1
AR     = ar cr
RANLIB = ranlib

#=================================================
# Solaris
#=================================================

#CC     = cc -g -xc99
#CFLAGS =
#PIC    = -fpic
#LFLAGS = -lm -lnsl -lsocket
#LUA    = /usr/local/lib/lua/5.1
#AR     = ar cr
#RANLIB = ranlib

#=================================================

dotest : built/dotest 

lua : built/dns.so

lib : built/libspcdns.a

so : built/libspcdns.so

all : built/dotest built/dns.so built/libspcdns.a built/libspcdns.so

#==================================================

built/libspcdns.a : built/codec.o built/mappings.o
	$(AR) [email protected] built/codec.o built/mappings.o
	$(RANLIB) [email protected]

built/libspcdns.so : built/codec.pic.o built/mappings.pic.o
	$(CC) -shared -o [email protected] built/codec.pic.o built/mappings.pic.o 
	
built/codec.o : src/codec.c src/dns.h
	$(CC) $(CFLAGS) -c -o [email protected] $<

built/codec.pic.o : src/codec.c src/dns.h
	$(CC) $(CFLAGS) $(PIC) -c -o [email protected] $<
	
built/mappings.o : src/mappings.c src/mappings.h
	$(CC) $(CFLAGS) -c -o [email protected] $<

built/mappings.pic.o : src/mappings.c src/mappings.h
	$(CC) $(CFLAGS) $(PIC) -c -o [email protected] $<

built/netsimple.o : src/netsimple.c src/netsimple.h
	$(CC) $(CFLAGS) -c -o [email protected] $<

built/netsimple.pic.o : src/netsimple.c src/netsimple.h
	$(CC) $(CFLAGS) $(PIC) -c -o [email protected] $<

#==============================================================


built/dotest : built/test.o 		\
		built/codec.o 		\
		built/mappings.o	\
		built/netsimple.o
	$(CC) -o [email protected] built/test.o 	\
		built/codec.o		\
		built/mappings.o	\
		built/netsimple.o	\
		$(LFLAGS)

built/test.o : src/test.c src/dns.h src/mappings.h src/netsimple.h
	$(CC) $(CFLAGS) -c -o [email protected] $<

#=============================================================

built/dns.so : built/luadns.o 		\
		built/codec.pic.o 	\
		built/mappings.pic.o	\
		built/netsimple.pic.o
	$(CC) -o [email protected] -shared 	 	\
		built/luadns.o		\
		built/codec.pic.o	\
		built/mappings.pic.o 	\
		built/netsimple.pic.o

	
built/luadns.o : src/luadns.c src/dns.h src/mappings.h
	$(CC) $(CFLAGS) $(PIC) -c -o [email protected] $<

#===========================================================

install-lua: built/dns.so
	install -d $(LUA)/org/conman
	install built/dns.so $(LUA)/org/conman
	
clean:
	/bin/rm -rf built/*
	/bin/rm -rf *~ src/*~ lua/*~

tarball:
	(cd .. ; tar czvf /tmp/spcdns.tar.gz -X spcdns/.exclude spcdns/ )