blob: fb544d5b6fc455d87d8035b01fc81027552843ff [file] [log] [blame]
# Copyright 2013, Big Switch Networks, Inc.
#
# LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
# the following special exception:
#
# LOXI Exception
#
# As a special exception to the terms of the EPL, you may distribute libraries
# generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
# that copyright and licensing notices generated by LoxiGen are not altered or removed
# from the LoxiGen Libraries and the notice provided below is (i) included in
# the LoxiGen Libraries, if distributed in source code form and (ii) included in any
# documentation for the LoxiGen Libraries, if distributed in binary form.
#
# Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
#
# You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
# a copy of the EPL at:
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# EPL for the specific language governing permissions and limitations
# under the EPL.
# Makefile to test LOCI generated files locally
# Assumes code is in BigCode layout
# Normally the loci and locitest code is put into a directory 'local' with
# this make file copied to its top level.
LOCI_SOURCES:=$(wildcard Modules/loci/module/src/*.c)
LOCI_OBJECTS:=$(LOCI_SOURCES:.c=.o)
LOCI_HEADERS:=$(wildcard Modules/loci/module/inc/loci/*.h)
LOCI_HEADERS+=$(wildcard Modules/loci/module/src/*.h)
LOCITEST_SOURCES:=$(wildcard Modules/locitest/module/src/*.c)
LOCITEST_OBJECTS:=$(LOCITEST_SOURCES:.c=.o)
LOCITEST_HEADERS:=$(wildcard Modules/locitest/module/inc/locitest/*.h)
LOCITEST_HEADERS+=$(wildcard Modules/locitests/module/src/*.h)
LOCITEST_MAIN:=Modules/locitest/utest/main.c
ALL_SOURCES:=${LOCITEST_SOURCES} ${LOCI_SOURCES}
ALL_OBJECTS:=$(ALL_SOURCES:.c=.o)
ALL_HEADERS:=${LOCITEST_HEADERS} ${LOCI_HEADERS}
CFLAGS:=-Wall -g -I Modules/loci/module/inc -I Modules/locitest/module/inc -O0
all: test
test: locitest
./locitest
%.o: %.c ${ALL_HEADERS}
gcc -c ${CFLAGS} $< -o $@
%.E: %.c ${ALL_HEADERS}
gcc -E ${CFLAGS} $< -o $@
libloci.a: ${LOCI_OBJECTS}
ar rcu libloci.a ${LOCI_OBJECTS}
ranlib libloci.a
liblocitest.a: ${LOCITEST_OBJECTS}
ar rcu liblocitest.a ${LOCITEST_OBJECTS}
ranlib liblocitest.a
# Test executable
locitest: ${LOCITEST_MAIN} libloci.a liblocitest.a
gcc $< ${CFLAGS} -l locitest -l loci -L . -o $@
show:
@echo ALL_SOURCES ${ALL_SOURCES}
@echo ALL_OBJECTS ${ALL_OBJECTS}
@echo ALL_HEADERS ${ALL_HEADERS}
help:
@echo "Run loci unit tests locally"
clean:
find . -name '*.o' | xargs rm -f
find . -name '*.E' | xargs rm -f
rm -f libloci.a liblocitest.a locitest
# TBD
doc: ${ALL_HEADERS}
doxygen Doxyfile
.PHONY: all test lib clean show doc