summaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2021-10-27 09:45:46 +0200
committerMikhail Burakov <mburakov@mailbox.org>2021-10-27 09:45:46 +0200
commit851f78ba58463fe1c91d141172a15c971782dbe4 (patch)
tree2776d1980e6ec3bd52d738ef5f6ef2e97c580890 /makefile
parent2f666613e353f3cb58e531682a106f4627e453af (diff)
Import existing code to mqhttp
Diffstat (limited to 'makefile')
-rw-r--r--makefile30
1 files changed, 30 insertions, 0 deletions
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