1# 2# Copyright 2016, NICTA 3# 4# This software may be distributed and modified according to the terms of 5# the GNU General Public License version 2. Note that NO WARRANTY is provided. 6# See "LICENSE_GPLv2.txt" for details. 7# 8# @TAG(NICTA_GPL) 9# 10 11NAME=serial 12 13SRC=serial.cogent 14OUTPUT=generated # $(SRC:.cogent=-gen) 15COUTPUT=$(addsuffix .c, $(OUTPUT)) 16HOUTPUT=$(addsuffix .h, $(OUTPUT)) 17 18LIBGUM=$(shell cogent --libgum-dir) 19 20AHFILES=$(LIBGUM)/gum/anti/abstract/WordArray.ah 21ACFILES=main.ac 22 23PP=$(ACFILES:.ac=_pp.ac) 24PPINFER=$(ACFILES:.ac=_pp_inferred.c) 25 26ABSDIR=./abstract 27 28OBJ=$(PPINFER:.c=.o) 29 30CFLAGS+=-I. -I$(LIBGUM) -std=gnu99 31 32.PHONY: default cogent clean gen-anti test 33.SECONDARY: 34 35default: all 36 37all: gen-anti $(OBJ) 38 $(CC) -o $(NAME) $(OBJ) 39 40test: gen-anti $(OBJ) 41 42$(OBJ): $(PPINFER) 43 44gen-anti: 45 mkdir -p $(ABSDIR) 46 cogent -g $(SRC) --infer-c-types="$(AHFILES)" --infer-c-funcs="$(ACFILES)" --cpp-args="\$$CPPIN -E -P $(CFLAGS) -o \$$CPPOUT" --ext-types=types.cfg --entry-funcs=entrypoints.cfg -O1 --fno-fncall-as-macro -ogenerated 47 48clean: 49 rm -f $(COUTPUT) $(HOUTPUT) $(PP) $(PPINFER) $(OBJ) 50 rm -f generated.o 51 rm -rf $(ABSDIR) 52 rm -f $(NAME) 53 54