From 851f78ba58463fe1c91d141172a15c971782dbe4 Mon Sep 17 00:00:00 2001 From: Mikhail Burakov Date: Wed, 27 Oct 2021 09:45:46 +0200 Subject: Import existing code to mqhttp --- makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 makefile (limited to 'makefile') diff --git a/makefile b/makefile new file mode 100644 index 0000000..7d08771 --- /dev/null +++ b/makefile @@ -0,0 +1,30 @@ +bin:=$(notdir $(shell pwd)) +src:=$(shell ls *.c) +obj:=$(src:.c=.o) + +libs:=luajit + +CFLAGS?=\ + -march=native -O3 -flto \ + -Wall -Wextra -pedantic \ + -D_GNU_SOURCE + +LDFLAGS?=\ + -O3 -s -flto \ + -lmosquitto + +CFLAGS+=$(shell pkg-config --cflags $(libs)) +LDFLAGS+=$(shell pkg-config --libs $(libs)) + +all: $(bin) + +$(bin): $(obj) + $(CC) $^ $(LDFLAGS) -o $@ + +%.o: %.c *.h + $(CC) -c $< $(CFLAGS) -o $@ + +clean: + -rm $(bin) $(obj) + +.PHONY: all clean -- cgit v1.2.3