fake-enum 0.1.4

A rust crate for creating FFI safe "fake" enum types
Documentation
# Copyright 2021 Connor Horman

# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Makefile.in template for library rust projects


# Root Options

ifeq ($(OS),Windows_NT)
DLLEXT = .dll
else
DLLEXT = .so
endif

srcdir = @srcdir@
builddir = @builddir@
abs_builddir = @abs_builddir@

RUSTC = @RUSTC@
RUSTFLAGS := @RUSTFLAGS@

INSTALL := @INSTALL@

RUSTC_IS_LCCC = @rustc_is_lccc@

## Install directories

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datarootdir = @datarootdir@
datadir = @datadir@
mandir = @mandir@
docdir = @docdir@
infodir = @infodir@
localedir = @localedir@
sysconfdir = @sysconfdir@
localstatedir = @localstatedir@
runstatedir = @runstatedir@
sharedstatedir = @sharedstatedir@


# Other Configuration

features = 
binaries =
tests = 
# Package specific Configuration

EXTRA_RUSTFLAGS = 

# The package version
version = 0.1.4

# The output file of the library
OUTPUT = fake-enum

# The crate name of the library
CRATE_NAME = fake_enum

# The path to find dependencies located in

DEPENDENCY_DIR = @abs_builddir@/vendor

# Any dependencies of the library
DEPENDENCIES = 

PROC_MACROS = 

SUBDIRS = 

# Autogenerated variables

file_to_crate = $(subst -,_,$(1))

binary_outputs = $(foreach bin,$(binaries),$(bin)@EXEEXT@)

CFG = $(foreach feature,$(features),feature="$feature") 

EXTERN_CRATES = $(foreach procmacro,$(PROC_MACROS),$(call file_to_crate,$(notdir $(procmacro)))=$(DEPENDENCY_DIR)/$(build)/$(procmacro)/lib$(procmacro).$(DLLEXT))  $(foreach dep,$(DEPENDENCIES),--extern $(call file_to_crate,$(notdir $(dep)))=$(DEPENDENCY_DIR)/$(dep)/lib$(dep).rlib)

export CARGO_PKG_VERSION=$(version)
export CARGO_MANIFEST_DIR=@abs_srcdir@
export OUT_DIR=@abs_builddir@

# Targets

all: 
	+@srcdir@/build-dirs.sh $(SUBDIRS)
	+$(MAKE) stamp

.PHONY: all clean distclean install install-strip $(binary_outputs:%=install-%) $(binary_outputs:%=install-strip-%) $(foreach subdir,$(SUBDIRS),$(subdir)/install) $(foreach subdir,$(SUBDIRS),$(subdir)/install-strip) $(foreach subdir,$(SUBDIRS),$(subdir)/clean) $(foreach subdir,$(SUBDIRS),$(subdir)/distclean) $(foreach subdir,$(SUBDIRS),$(subdir)/check)


Makefile: config.status @srcdir@/Makefile.in
	@builddir@/config.status Makefile


config.status: @srcdir@/configure
	@builddir@/config.status --recheck


stamp: $(binaries) $(OUTPUT)
	touch stamp

$(OUTPUT): Makefile


include $(OUTPUT).d

$(OUTPUT).d: $(srcdir)/src/lib.rs $(foreach subdir,$(SUBDIRS),$(subdir)/stamp)
	$(RUSTC) $(RUSTFLAGS) $(EXTRA_RUSTFLAGS) $(foreach cfg,$(CFG),--cfg $(cfg)) --crate-name $(CRATE_NAME) --crate-type rlib --emit dep-info=@builddir@/$(OUTPUT).d -o$(OUTPUT) $< $(EXTERN_CRATES)

$(OUTPUT): $(srcdir)/src/lib.rs $(foreach subdir,$(SUBDIRS),$(subdir)/stamp)
	+$(RUSTC) $(RUSTFLAGS) $(EXTRA_RUSTFLAGS) $(foreach cfg,$(CFG),--cfg $(cfg)) --crate-name $(CRATE_NAME) --crate-type rlib --emit dep-info=@builddir@/$(OUTPUT).d --emit link=@abs_builddir@/$(OUTPUT) -o$(OUTPUT) $< $(EXTERN_CRATES)

include $(foreach bin,$(binary_outputs),$(bin).d)

$(foreach out,$(binary_outputs),$(out).d): %@EXEEXT@.d: $(srcdir)/src/bin/%.rs $(OUTPUT)
	$(RUSTC) $(RUSTFLAGS) $(EXTRA_RUSTFLAGS)$(foreach cfg,$(CFG),--cfg $(cfg)) --crate-name $(call file_to_crate,$*) --crate-type bin --emit dep-info=@builddir@/$@ -o$*@EXEEXT@ $< $(EXTERN_CRATES) --extern $(CRATE_NAME)=@abs_builddir@/$(OUTPUT)

$(binary_outputs): %@EXEEXT@: $(srcdir)/src/bin/%.rs $(OUTPUT)
	+$(RUSTC) $(RUSTFLAGS) $(EXTRA_RUSTFLAGS) $(foreach cfg,$(CFG),--cfg $(cfg)) --crate-name $(call file_to_crate,$*) --crate-type bin --emit dep-info=@builddir@/$@.d --emit link=@abs_builddir@/$@ -o$@ $< $(EXTERN_CRATES) --extern $(CRATE_NAME)=@abs_builddir@/$(OUTPUT)

clean: $(foreach subdir,$(SUBDIRS),$(subdir)/clean)
	rm -f $(OUTPUT) $(binary_outputs) test-$(OUTPUT:%.rlib=%@EXEEXT@) $(tests:%.rs=%@EXEEXT@) stamp

distclean: clean $(foreach subdir,$(SUBDIRS),$(subdir)/distclean)
	rm -f config.status config.log $(OUTPUT).d test-$(OUTPUT:%.rlib=%@EXEEXT@).d $(foreach out,$(binary_outputs),$(out).d) Makefile

$(binary_outputs:%=install-%): install-%: %
	$(INSTALL) -m755 $< ${bindir}/

$(binary_outputs:%=install-strip-%): install-strip-%: %
	$(INSTALL) -s -m755 $< ${bindir}/

install: $(binary_outputs:%=install-%) $(foreach subdir,$(SUBDIRS),$(subdir)/install)

install-strip: $(binary_outputs:%=install-strip-%) $(foreach subdir,$(SUBDIRS),$(subdir)/install-strip)

include test-$(OUTPUT:%.rlib=%@EXEEXT@).d

tests/:
	mkdir tests/

test-$(OUTPUT:%.rlib=%@EXEEXT@).d: $(srcdir)/src/lib.rs
	$(RUSTC) $(RUSTFLAGS) $(EXTRA_RUSTFLAGS)  $(foreach cfg,$(CFG),--cfg $(cfg)) --cfg test --crate-name $(CRATE_NAME) --test --emit dep-info=@builddir@/test-$(OUTPUT:%.rlib=%@EXEEXT@).d -otest-$(OUTPUT:%.rlib=%@EXEEXT@) $< $(EXTERN_CRATES)

test-$(OUTPUT:%.rlib=%@EXEEXT@): $(srcdir)/src/lib.rs
	+$(RUSTC) $(RUSTFLAGS) $(EXTRA_RUSTFLAGS)  $(foreach cfg,$(CFG),--cfg $(cfg)) --cfg test --crate-name $(CRATE_NAME) --test --emit dep-info=@builddir@/test-$(OUTPUT:%.rlib=%@EXEEXT@).d --emit link=@abs_builddir@/test-$(OUTPUT:%.rlib=%@EXEEXT@) -o$(OUTPUT:%.rlib=%@EXEEXT@) $< $(EXTERN_CRATES)

$(tests:%.rs=%@EXEEXT@): %@EXEEXT@: $(srcdir)/%.rs $(OUTPUT) tests/
	+$(RUSTC) $(RUSTFLAGS) $(EXTRA_RUSTFLAGS) $(foreach cfg,$(CFG),--cfg $(cfg)) --crate-name $(call file_to_crate,$(*F)) --test --emit dep-info=@builddir@/$@.d --emit link=@abs_builddir@/$@ -o$@ $< $(EXTERN_CRATES) --extern $(CRATE_NAME)=@abs_builddir@/$(OUTPUT)

check: @builddir@/test-$(OUTPUT:%.rlib=%@EXEEXT@) $(tests:%.rs=@builddir@/%@EXEEXT@) $(foreach subdir,$(SUBDIRS),$(subdir)/check)
	$(srcdir)/run-tests.sh $(foreach file,$^,@builddir@/$(file))

%/stamp: %/Makefile
	+$(MAKE) -C $* stamp

%/clean:
	+$(MAKE) -C $* clean

%/install:
	+$(MAKE) -C $* install
%/install:
	+$(MAKE) -C $* install-strip

%/check:
	+$(MAKE) -C $* check