Add C code skeleton for SQP implementaion.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 19 Oct 2018 19:15:09 +0000 (21:15 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 19 Oct 2018 19:15:09 +0000 (21:15 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
.gitignore
implémentation/.cquery [new file with mode: 0644]
implémentation/.gitignore [new file with mode: 0644]
implémentation/Makefile [new file with mode: 0644]
implémentation/main.c [new file with mode: 0644]

index 299f3e310a98130c76481e7f9010988f13dedd76..e1bd09c85556852b08750fcd1038204e0ef9c363 100644 (file)
@@ -1,3 +1,4 @@
+# latexmk
 *.aux
 *.bbl
 *.blg
@@ -10,3 +11,6 @@
 *.snm
 *.synctex.*
 *.toc
+
+# ide-cquery
+.atom
diff --git a/implémentation/.cquery b/implémentation/.cquery
new file mode 100644 (file)
index 0000000..9e6ef79
--- /dev/null
@@ -0,0 +1,4 @@
+%clang
+%c -std=c11
+%cpp -std=c++11
+-Weverything
diff --git a/implémentation/.gitignore b/implémentation/.gitignore
new file mode 100644 (file)
index 0000000..f1ad304
--- /dev/null
@@ -0,0 +1,26 @@
+sqp
+*.static
+*.dynamic
+# for cygwin
+*.exe
+
+*.o
+
+*.so
+*.dylib
+*.a
+# for cygwin
+*.dll
+*.dll.a
+
+# atom linter
+*.gch
+
+# editor trash
+*.swp
+*~
+
+.build
+
+thumbs.db
+*.DS_Store
diff --git a/implémentation/Makefile b/implémentation/Makefile
new file mode 100644 (file)
index 0000000..fc1c15e
--- /dev/null
@@ -0,0 +1,82 @@
+# Sample Makefile to build simple project.
+#
+# This Makefile expect all source files (.c) to be at the same level, in the
+# current working directory.
+#
+# It will automatically generate dependencies, compile all files, and produce a
+# binary using the provided name.
+#
+# Set BINARY_NAME to the name of the binary file to build.
+# Set BUILD_TYPE to either debug or release
+#
+# Automatic dependencies code from:
+# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
+BINARY_NAME=sqp
+#BUILD_TYPE=debug
+BUILD_TYPE=release
+
+# ====================================
+# DO NOT CHANGE STUFF BEYOND THIS LINE
+# ====================================
+
+all: $(BINARY_NAME)
+
+CC=gcc
+LD=gcc
+
+WARN_FLAGS = -Wall -Wextra
+STD_FLAG = -std=c11
+
+ifeq ($(BUILD_TYPE),debug)
+BUILDDIR := .build/debug
+DEBUG_FLAG = -g
+DEBUG = 1
+STRIP_FLAG =
+OPTI_FLAG = -O0
+else
+BUILDDIR := .build/release
+DEBUG_FLAG =
+DEBUG = 0
+STRIP_FLAG = -s
+OPTI_FLAG = -O3
+endif
+
+CFLAGS := -DDEBUG=$(DEBUG) $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
+
+OBJDIR := $(BUILDDIR)/objs
+$(shell mkdir -p $(OBJDIR))
+
+SRCS=$(wildcard *.c)
+OBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
+
+DEPDIR := $(BUILDDIR)/deps
+$(shell mkdir -p $(DEPDIR))
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
+POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
+
+$(BINARY_NAME): $(OBJS)
+       @echo "[LD ] $@"
+       @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
+       @echo "[C  ] $*"
+       @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+       @$(POSTCOMPILE)
+
+$(DEPDIR)/%.d: ;
+
+.PRECIOUS: $(DEPDIR)/%.d
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+
+clean:
+       @echo "[CLN]"
+       -@rm -r $(BUILDDIR)
+       -@rm $(BINARY_NAME)
+
+disassemble: $(BINARY_NAME)
+       objdump -d $< | less
+
+symbols: $(BINARY_NAME)
+       objdump -t $< | sort | less
diff --git a/implémentation/main.c b/implémentation/main.c
new file mode 100644 (file)
index 0000000..32d1af6
--- /dev/null
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main() {
+
+    return 0;
+}