From f12bd30b1e7da1d31861c9c43ca3020f1a2dbe3a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 19 Oct 2018 21:15:09 +0200 Subject: [PATCH] Add C code skeleton for SQP implementaion. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .gitignore | 4 ++ "impl\303\251mentation/.cquery" | 4 ++ "impl\303\251mentation/.gitignore" | 26 ++++++++++ "impl\303\251mentation/Makefile" | 82 ++++++++++++++++++++++++++++++ "impl\303\251mentation/main.c" | 6 +++ 5 files changed, 122 insertions(+) create mode 100644 "impl\303\251mentation/.cquery" create mode 100644 "impl\303\251mentation/.gitignore" create mode 100644 "impl\303\251mentation/Makefile" create mode 100644 "impl\303\251mentation/main.c" diff --git a/.gitignore b/.gitignore index 299f3e3..e1bd09c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +# latexmk *.aux *.bbl *.blg @@ -10,3 +11,6 @@ *.snm *.synctex.* *.toc + +# ide-cquery +.atom diff --git "a/impl\303\251mentation/.cquery" "b/impl\303\251mentation/.cquery" new file mode 100644 index 0000000..9e6ef79 --- /dev/null +++ "b/impl\303\251mentation/.cquery" @@ -0,0 +1,4 @@ +%clang +%c -std=c11 +%cpp -std=c++11 +-Weverything diff --git "a/impl\303\251mentation/.gitignore" "b/impl\303\251mentation/.gitignore" new file mode 100644 index 0000000..f1ad304 --- /dev/null +++ "b/impl\303\251mentation/.gitignore" @@ -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\303\251mentation/Makefile" "b/impl\303\251mentation/Makefile" new file mode 100644 index 0000000..fc1c15e --- /dev/null +++ "b/impl\303\251mentation/Makefile" @@ -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\303\251mentation/main.c" "b/impl\303\251mentation/main.c" new file mode 100644 index 0000000..32d1af6 --- /dev/null +++ "b/impl\303\251mentation/main.c" @@ -0,0 +1,6 @@ +#include + +int main() { + + return 0; +} -- 2.34.1