summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kocialkowski2016-11-21 22:13:39 +0100
committerPaul Kocialkowski2016-11-22 13:27:38 +0100
commit76bc9028e9585a06717bb051ec72612e57b88b52 (patch)
tree4e07e48590702f1208f69d8bc57e6ed857136a07
Canard include file and compiler initial commit
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--Makefile36
-rwxr-xr-xbin/canardcc3
-rw-r--r--examples/Makefile66
-rwxr-xr-xexamples/build/examplebin0 -> 8392 bytes
-rw-r--r--examples/build/example.d1
-rw-r--r--examples/build/example.obin0 -> 1504 bytes
-rwxr-xr-xexamples/examplebin0 -> 8392 bytes
-rw-r--r--examples/example.c13
-rw-r--r--include/canard.h50
9 files changed, 169 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b94eb6e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+# Tools
+
+CC = gcc
+INSTALL = install
+
+# Project
+
+NAME = code
+
+# Directories
+
+BIN = bin
+INCLUDE = include
+PREFIX ?= /usr/local
+
+# Sources
+
+SOURCES_BIN = canardcc
+SOURCES_INCLUDE = canard.h
+
+# Produced files
+
+INSTALL_BIN = $(PREFIX)/bin
+INSTALL_INCLUDE = $(PREFIX)/include
+OUTPUT_DIRS = $(sort $(dir $(INSTALL_BIN)) $(dir $(INSTALL_INCLUDE)))
+
+all: install
+
+$(OUTPUT_DIRS):
+ $(foreach dir,$(OUTPUT_DIRS),install -d $(dir))
+
+.PHONY: install
+install: $(OUTPUT_DIRS)
+ @echo " INSTALL"
+ $(foreach source,$(SOURCES_BIN),@install $(BIN)/$(source) $(INSTALL_BIN)/$(source))
+ $(foreach source,$(SOURCES_INCLUDE),@install $(INCLUDE)/$(source) $(INSTALL_INCLUDE)/$(source))
diff --git a/bin/canardcc b/bin/canardcc
new file mode 100755
index 0000000..c60f67f
--- /dev/null
+++ b/bin/canardcc
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+gcc -include /usr/local/include/canard.h "$@"
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 0000000..57acf05
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,66 @@
+# Tools
+
+CC = canardcc
+
+# Project
+
+NAME = example
+
+# Directories
+
+BUILD = build
+OUTPUT = .
+
+# Sources
+
+SOURCES = example.c
+OBJECTS = $(SOURCES:.c=.o)
+DEPS = $(SOURCES:.c=.d)
+
+# Compiler
+
+CFLAGS =
+LDFLAGS =
+
+# Produced files
+
+BUILD_OBJECTS = $(addprefix $(BUILD)/,$(OBJECTS))
+BUILD_DEPS = $(addprefix $(BUILD)/,$(DEPS))
+BUILD_BINARY = $(BUILD)/$(NAME)
+BUILD_DIRS = $(sort $(dir $(BUILD_BINARY) $(BUILD_OBJECTS)))
+
+OUTPUT_BINARY = $(OUTPUT)/$(NAME)
+OUTPUT_DIRS = $(sort $(dir $(OUTPUT_BINARY)))
+
+all: $(OUTPUT_BINARY)
+
+$(BUILD_DIRS):
+ @mkdir -p $@
+
+$(BUILD_OBJECTS): $(BUILD)/%.o: %.c | $(BUILD_DIRS)
+ @echo " CC $<"
+ @$(CC) $(CFLAGS) -MMD -MF $(BUILD)/$*.d -c $< -o $@
+
+$(BUILD_BINARY): $(BUILD_OBJECTS)
+ @echo " LINK $@"
+ @$(CC) $(CFLAGS) -o $@ $(BUILD_OBJECTS) $(LDFLAGS)
+
+$(OUTPUT_DIRS):
+ @mkdir -p $@
+
+$(OUTPUT_BINARY): $(BUILD_BINARY) | $(OUTPUT_DIRS)
+ @echo " BINARY $@"
+ @cp $< $@
+
+.PHONY: clean
+clean:
+ @echo " CLEAN"
+ @rm -rf $(foreach object,$(basename $(BUILD_OBJECTS)),$(object)*) $(basename $(BUILD_BINARY))*
+ @rm -rf $(OUTPUT_BINARY)
+
+.PHONY: distclean
+distclean: clean
+ @echo " DISTCLEAN"
+ @rm -rf $(BUILD)
+
+-include $(BUILD_DEPS)
diff --git a/examples/build/example b/examples/build/example
new file mode 100755
index 0000000..7d60f50
--- /dev/null
+++ b/examples/build/example
Binary files differ
diff --git a/examples/build/example.d b/examples/build/example.d
new file mode 100644
index 0000000..c426230
--- /dev/null
+++ b/examples/build/example.d
@@ -0,0 +1 @@
+build/example.o: example.c /usr/local/include/canard.h
diff --git a/examples/build/example.o b/examples/build/example.o
new file mode 100644
index 0000000..1984bb4
--- /dev/null
+++ b/examples/build/example.o
Binary files differ
diff --git a/examples/example b/examples/example
new file mode 100755
index 0000000..7d60f50
--- /dev/null
+++ b/examples/example
Binary files differ
diff --git a/examples/example.c b/examples/example.c
new file mode 100644
index 0000000..be9606f
--- /dev/null
+++ b/examples/example.c
@@ -0,0 +1,13 @@
+#include <canard.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+magret main
+bouffe le magret argc et avale le canneton argv[] puis gerbe
+digere
+ magret i pan 10 coin
+
+ printf bouffe " Hello World!\n " gerbe coin
+
+ chie 0 coin
+gere
diff --git a/include/canard.h b/include/canard.h
new file mode 100644
index 0000000..e31581f
--- /dev/null
+++ b/include/canard.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2016 Jerome Coste <jerome.coste@etu.utc.fr>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _CANARD_H_
+#define _CANARD_H_
+
+#define avale ,
+#define coin ;
+#define digere {
+#define gere }
+#define bouffe (
+#define gerbe )
+#define pan =
+#define canard if
+#define placo else
+#define collectionne while
+#define couve for
+#define chie return
+
+#define magret int
+#define cane short
+#define canneton char
+#define conflit unsigned
+
+#define et
+#define le
+#define la
+#define de
+#define des
+#define avec
+#define un
+#define une
+#define puis
+
+#endif