X-Git-Url: http://rtime.felk.cvut.cz/gitweb/coffee/mt-apps.git/blobdiff_plain/fc572a44fa5508a743d39a0298d5b85465c8040a..HEAD:/Makefile diff --git a/Makefile b/Makefile index ee73c39..30af7ed 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,53 @@ -SOURCE_FILES = mt_rfid.c -OUTPUT_FILE = mt-rfid -LIBRARIES = -lev -luFCoder-armhf +OUTPUT_DIR = build -all: $(SOURCE_FILES) - $(CC) $(CFLAGS) -o $(OUTPUT_FILE) $(SOURCE_FILES) $(LIBRARIES) +ifeq ($(SIM),) +# Compile for terminal +all: mtrfid mtserver mtkeys mtaio +else +# Compile just simulator +all: mtaio +endif + +mtrfid_SRCS = signal_exit.c mt_rfid.c +mtrfid_LIBS = -lev -luFCoder-armhf +mtrfid_DEFS = -DHAVE_RFID=1 + +mtserver_SRCS = signal_exit.c mt_server.c +mtserver_LIBS = -lev -lwebsockets + +mtkeys_SRCS = signal_exit.c mt_keys.c +mtkeys_LIBS = -lev + +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 ($(SIM),) +mtaio_SRCS += mt_rfid.c +mtaio_LIBS += -luFCoder-armhf +else +mtaio_SRCS += mt_sim.c +mtaio_DEFS += -DSIM=1 -Ilibwebsockets/include -Llibwebsockets/lib -g +mtaio_LIBS += -lz $(shell pkg-config --libs openssl) + +libwebsockets/CMakeLists.txt: + git submodule update --init libwebsockets + +libwebsockets/CMakeCache.txt: libwebsockets/CMakeLists.txt + cd libwebsockets && cmake -DLWS_WITH_LIBEV=ON -DLWS_WITH_SHARED=OFF -DLWS_WITHOUT_TESTAPPS=ON . + +libwebsockets/lib/libwebsockets.a: libwebsockets/CMakeCache.txt + cd libwebsockets && cmake --build . + +mt_server.c: libwebsockets/lib/libwebsockets.a +endif .PHONY: clean clean: - rm -f $(OUTPUT_FILE) + rm -rf $(OUTPUT_DIR) + +.SECONDEXPANSION: +mtserver mtkeys mtaio mtrfid: $$($$@_SRCS) + mkdir -p $(OUTPUT_DIR) + $(CC) $(CFLAGS) $($@_DEFS) -o $(OUTPUT_DIR)/$@ $^ $($@_LIBS)