blob: d5d1f7ad446cd1efc90efa6aa08275bb4d7b8b58 [file] [log] [blame] [edit]
# Copyright 2019, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the GNU General Public License version 2. Note that NO WARRANTY is provided.
# See "LICENSE_GPLv2.txt" for details.
#
# @TAG(DATA61_GPL)
#
NAME=file-copy
SRC=FileFFI.cogent
LIBGUM=$(shell cogent --libgum-dir)
ACFILES=main.ac
AHFILES=file.ah
PP=$(ACFILES:.ac=_pp.ac)
PPINFER=$(ACFILES:.ac=_pp_inferred.c)
ABSDIR=./abstract
OBJ=$(PPINFER:.c=.o)
CFLAGS+=-I. -I$(LIBGUM) -I$(LIBGUM)/gum/anti -std=gnu99 -I$(ABSDIR)
.PHONY: default clean gen-anti test
.SECONDARY:
default: all
all: gen-anti $(OBJ)
$(CC) -o $(NAME) $(OBJ)
test: gen-anti $(OBJ)
$(OBJ): $(PPINFER)
gen-anti:
mkdir -p $(ABSDIR)
cogent $(SRC) -g -Od -ogenerated --fno-fncall-as-macro --ffunc-purity-attr \
--infer-c-types="$(AHFILES)" \
--Wno-warn --infer-c-funcs="$(ACFILES)" \
--infer-c-types="$(AHFILES)" \
--cpp-args="-x c \$$CPPIN -o \$$CPPOUT -E -P $(CFLAGS)" \
--cpp=$(CPP) \
--ext-types=types.cfg \
--entry-funcs=entrypoints.cfg \
clean:
rm -f $(COUTPUT) $(HOUTPUT) $(PP) $(PPINFER) $(OBJ)
rm -rf generated.h generated.c
rm -f $(ABSDIR)/*.h
rm -rf $(ABSDIR)
rm -f $(NAME)