]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/commitdiff
Makefile: Remove all autodetection
authorMichal Sojka <michal.sojka@cvut.cz>
Wed, 8 Aug 2018 13:42:58 +0000 (15:42 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Wed, 8 Aug 2018 13:53:46 +0000 (15:53 +0200)
Simulator is now compiled as

    make SIM=1

Makefile
mt_rfid.h

index 7207748741b389af6dc4df7177f2059e84eb4a21..d6ad3d88367b9f071e07db9141539a725be1bb95 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,11 @@
 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
@@ -23,23 +22,13 @@ mtaio_SRCS    = signal_exit.c mt_keys.c mt_server.c mt_aio.c mt_blank.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
 
@@ -50,10 +39,13 @@ libwebsockets/lib/libwebsockets.a: libwebsockets/CMakeCache.txt
        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)
index 53fa84b7a725bc2fdf6366f46e2ec2e70d91f958..01acb9b7bcb2586e917b6a2a22de2b3a9be71fb4 100644 (file)
--- a/mt_rfid.h
+++ b/mt_rfid.h
@@ -16,8 +16,6 @@ typedef struct mt_rfid_t {
     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
@@ -38,13 +36,4 @@ void mt_rfid_deinit(mt_rfid_t *self);
 #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