aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..af6d185
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,27 @@
+CFILES_OTD = $(shell find ostp.d/ -name "*.c")
+CFILES_OTLIB = $(shell find lib/ -name "*.c")
+CFILES_CLIENT = $(shell find client/ -name "*.c")
+CFLAGS_OTD = -pedantic -Iostp.d/include/ -Ilib/include/
+CFLAGS_CLIENT = -pedantic -Iclient/include/ -Ilib/include/
+CFLAGS_OTLIB = -pedantic -Ilib/include/ -fPIC -lssl -lcrypto
+OTLIB_OBJ = $(CFILES_OTLIB:.c=.o)
+CC = gcc
+
+.PHONY: all
+all: $(OTLIB_OBJ) bin/ostp.d bin/client
+
+bin/ostp.d: $(CFILES_OTD)
+ mkdir -p $(@D)
+ $(CC) $(CFLAGS_OTD) $(OTLIB_OBJ) $^ -lssl -lcrypto -o $@
+
+bin/client: $(CFILES_CLIENT)
+ mkdir -p $(@D)
+ $(CC) $(CFLAGS_CLIENT) $(OTLIB_OBJ) $^ -lssl -lcrypto -o $@
+
+%.o: %.c
+ mkdir -p $(@D)
+ $(CC) -c $(CFLAGS_OTLIB) $< -o $@
+
+.PHONY: clean
+clean:
+ rm -rf bin/ $(OTLIB_OBJ)