Rich Lane | a06d0c3 | 2013-03-25 08:52:03 -0700 | [diff] [blame] | 1 | # Copyright 2013, Big Switch Networks, Inc. |
| 2 | # |
| 3 | # LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with |
| 4 | # the following special exception: |
| 5 | # |
| 6 | # LOXI Exception |
| 7 | # |
| 8 | # As a special exception to the terms of the EPL, you may distribute libraries |
| 9 | # generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided |
| 10 | # that copyright and licensing notices generated by LoxiGen are not altered or removed |
| 11 | # from the LoxiGen Libraries and the notice provided below is (i) included in |
| 12 | # the LoxiGen Libraries, if distributed in source code form and (ii) included in any |
| 13 | # documentation for the LoxiGen Libraries, if distributed in binary form. |
| 14 | # |
| 15 | # Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler." |
| 16 | # |
| 17 | # You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain |
| 18 | # a copy of the EPL at: |
| 19 | # |
| 20 | # http://www.eclipse.org/legal/epl-v10.html |
| 21 | # |
| 22 | # Unless required by applicable law or agreed to in writing, software |
| 23 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 24 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 25 | # EPL for the specific language governing permissions and limitations |
| 26 | # under the EPL. |
| 27 | |
| 28 | # Makefile to test LOCI generated files locally |
| 29 | # Assumes code is in BigCode layout |
| 30 | # Normally the loci and locitest code is put into a directory 'local' with |
| 31 | # this make file copied to its top level. |
| 32 | |
| 33 | LOCI_SOURCES:=$(wildcard Modules/loci/module/src/*.c) |
| 34 | LOCI_OBJECTS:=$(LOCI_SOURCES:.c=.o) |
| 35 | LOCI_HEADERS:=$(wildcard Modules/loci/module/inc/loci/*.h) |
| 36 | LOCI_HEADERS+=$(wildcard Modules/loci/module/src/*.h) |
| 37 | |
| 38 | LOCITEST_SOURCES:=$(wildcard Modules/locitest/module/src/*.c) |
| 39 | LOCITEST_OBJECTS:=$(LOCITEST_SOURCES:.c=.o) |
| 40 | LOCITEST_HEADERS:=$(wildcard Modules/locitest/module/inc/locitest/*.h) |
| 41 | LOCITEST_HEADERS+=$(wildcard Modules/locitests/module/src/*.h) |
| 42 | |
| 43 | LOCITEST_MAIN:=Modules/locitest/utest/main.c |
| 44 | |
| 45 | ALL_SOURCES:=${LOCITEST_SOURCES} ${LOCI_SOURCES} |
| 46 | ALL_OBJECTS:=$(ALL_SOURCES:.c=.o) |
| 47 | ALL_HEADERS:=${LOCITEST_HEADERS} ${LOCI_HEADERS} |
| 48 | |
| 49 | CFLAGS:=-Wall -g -I Modules/loci/module/inc -I Modules/locitest/module/inc -O0 |
| 50 | |
| 51 | all: test |
| 52 | |
| 53 | test: locitest |
| 54 | ./locitest |
| 55 | |
| 56 | %.o: %.c ${ALL_HEADERS} |
| 57 | gcc -c ${CFLAGS} $< -o $@ |
| 58 | |
| 59 | %.E: %.c ${ALL_HEADERS} |
| 60 | gcc -E ${CFLAGS} $< -o $@ |
| 61 | |
| 62 | libloci.a: ${LOCI_OBJECTS} |
| 63 | ar rcu libloci.a ${LOCI_OBJECTS} |
| 64 | ranlib libloci.a |
| 65 | |
| 66 | liblocitest.a: ${LOCITEST_OBJECTS} |
| 67 | ar rcu liblocitest.a ${LOCITEST_OBJECTS} |
| 68 | ranlib liblocitest.a |
| 69 | |
| 70 | # Test executable |
| 71 | locitest: ${LOCITEST_MAIN} libloci.a liblocitest.a |
| 72 | gcc $< ${CFLAGS} -l locitest -l loci -L . -o $@ |
| 73 | |
| 74 | show: |
| 75 | @echo ALL_SOURCES ${ALL_SOURCES} |
| 76 | @echo ALL_OBJECTS ${ALL_OBJECTS} |
| 77 | @echo ALL_HEADERS ${ALL_HEADERS} |
| 78 | |
| 79 | help: |
| 80 | @echo "Run loci unit tests locally" |
| 81 | |
| 82 | clean: |
| 83 | find . -name '*.o' | xargs rm -f |
| 84 | find . -name '*.E' | xargs rm -f |
| 85 | rm -f libloci.a liblocitest.a locitest |
| 86 | |
| 87 | # TBD |
| 88 | doc: ${ALL_HEADERS} |
| 89 | doxygen Doxyfile |
| 90 | |
| 91 | .PHONY: all test lib clean show doc |