summaryrefslogtreecommitdiff
path: root/libcmd/Makefile
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2016-05-10 22:42:11 +0100
committerFreeArtMan <dos21h@gmail.com>2016-05-10 22:42:11 +0100
commit44dedb90f005bb0de9bddbd592a5c78f28bc67d1 (patch)
tree274b9cea44df3f96a965c564e26cdac42d3af94f /libcmd/Makefile
parentbb426577c85f6d97cc28ab677e98e2b1f73eadac (diff)
downloadihe-44dedb90f005bb0de9bddbd592a5c78f28bc67d1.tar.gz
ihe-44dedb90f005bb0de9bddbd592a5c78f28bc67d1.zip
Replace cmd first part
Diffstat (limited to 'libcmd/Makefile')
-rw-r--r--libcmd/Makefile43
1 files changed, 43 insertions, 0 deletions
diff --git a/libcmd/Makefile b/libcmd/Makefile
new file mode 100644
index 0000000..86f0ae6
--- /dev/null
+++ b/libcmd/Makefile
@@ -0,0 +1,43 @@
+PROJ=libcmd
+CC=gcc
+CFLAGS=-g3
+LDFLAGS=
+RAGEL=ragel
+DOT=dot
+
+SOURCE=cmd cmd_parse
+OBJECTS=$(SOURCE:=.o)
+SOURCES=$(SOURCE:=.c)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $<
+
+
+make: dynamic static object
+
+dynamic: CFLAGS+=-fPIC
+dynamic: clean $(OBJECTS)
+ $(CC) $(CFLAGS) $(OBJECTS) -shared -o $(PROJ).so
+
+static: clean $(OBJECTS)
+ ar rcs $(PROJ).a $(OBJECTS)
+
+object: clean $(OBJECTS)
+ ld -r $(OBJECTS) -o $(PROJ).o
+
+ragel:
+ $(RAGEL) cmd_parse.ragel
+
+cli:
+ $(CC) $(CFLAGS) -L./ -I./ -lcmd ./test/cmd_cli.c -o ./cmd_cli
+
+pdf:
+ $(RAGEL) -V cmd_parse.ragel -o cmd_parse.dot
+ $(DOT) -Tpdf cmd_parse.dot -o cmd_parse.pdf
+
+leak:
+ valgrind --leak-check=full --track-origins=yes --log-file=log.txt ./cmd_cli
+
+clean:
+ rm -f cmd_cli
+ rm -rf *.so *.o *.dot *.pdf