OUTPUT_DIR = build
-can_compile = $(shell if echo '$(1)' | $(CC) $(CFLAGS) -c -xc - -o /dev/null >/dev/null 2>&1; then echo yes; fi)
-HAVE_RFID := $(call can_compile,\#include <uFCoder.h>)
-
-ifeq ($(HAVE_RFID),yes)
-all: mtrfid
+ifeq ($(SIM),)
+# Compile for terminal
+all: mtrfid mtserver mtkeys mtaio
else
-$(warning Compiling without RFID support)
+# Compile just simulator
+all: mtaio
endif
mtrfid_SRCS = signal_exit.c mt_rfid.c
mtaio_LIBS = -lev -lwebsockets
mtaio_DEFS = -DNO_MAIN -DHAVE_RFID=$(if $(HAVE_RFID),1,0)
-ifeq ($(HAVE_RFID),yes)
+ifeq ($(SIM),)
mtaio_SRCS += mt_rfid.c
mtaio_LIBS += -luFCoder-armhf
else
mtaio_SRCS += mt_sim.c
-mtaio_DEFS += -DSIM=1
-endif
-
-all: mtserver mtkeys mtaio
-
-.PHONY: clean
-
-clean:
- rm -rf $(OUTPUT_DIR)
+mtaio_DEFS += -DSIM=1 -Ilibwebsockets/include -Llibwebsockets/lib -g -lz $(shell pkg-config --libs openssl)
-# Check LWS version and compile our own if not found
-ifeq ($(shell pkg-config libwebsockets = 2.2.1 || echo no),no)
libwebsockets/CMakeLists.txt:
git submodupe update --init libwebsockets
cd libwebsockets && cmake --build .
mt_server.c: libwebsockets/lib/libwebsockets.a
-
-CFLAGS += -Ilibwebsockets/include -Llibwebsockets/lib -g -lz $(shell pkg-config --libs openssl)
endif
+.PHONY: clean
+
+clean:
+ rm -rf $(OUTPUT_DIR)
+
.SECONDEXPANSION:
mtserver mtkeys mtaio mtrfid: $$($$@_SRCS)
mkdir -p $(OUTPUT_DIR)
int fd; // print JSON output here
} mt_rfid_t;
-#if HAVE_RFID
-
// reader open parameters, see uFR manual
#define UFR_READER_TYPE 1 // uFR type (1Mbps)
#define UFR_PORT_INTERFACE 1 // serial; auto->ftdi->FAIL
#define mt_rfid_init(self, loop, fd) 0
#define mt_rfid_deinit(self) 0
-#endif /* HAVE_RFID */
-
-void rfid_json_print(int fd,
- uint8_t card_type,
- uint8_t sak, //select acknowledge
- char *uid,
- uint8_t size);
-
-
#endif