{"id":2740,"date":"2025-07-23T14:37:23","date_gmt":"2025-07-23T13:37:23","guid":{"rendered":"https:\/\/workboot.fr\/ciela\/?page_id=2740"},"modified":"2025-07-23T14:37:24","modified_gmt":"2025-07-23T13:37:24","slug":"create_projectc","status":"publish","type":"page","link":"https:\/\/workboot.fr\/ciela\/create_projectc\/","title":{"rendered":"create_projectc"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\n# V\u00e9rifie si un nom de projet est fourni\nif &#91; $# -eq 0 ]; then\n    echo \"Usage: $0 &lt;nom_projet>\"\n    exit 1\nfi\n\nPROJECT_NAME=$1\nSRC_DIR=\"src\"\nINC_DIR=\"inc\"\nBIN_DIR=\"bin\"\n\n# Cr\u00e9e l'arborescence du projet\nmkdir -p \"$PROJECT_NAME\"\ncd \"$PROJECT_NAME\" || exit\nmkdir -p \"$SRC_DIR\" \"$INC_DIR\" \"$BIN_DIR\"\n\n# Cr\u00e9e le fichier main.c\ncat > \"$SRC_DIR\/main.c\" &lt;&lt;EOF\n#include &lt;stdio.h>\n#include &lt;stdlib.h>\n#include \"${PROJECT_NAME}.h\"\n\nint main(int argc, char *argv&#91;])\n{\n    printf(\"Hello, ${PROJECT_NAME}!\\\\n\");\n    return EXIT_SUCCESS;\n}\nEOF\n\n# Cr\u00e9e le fichier header\ncat > \"$INC_DIR\/${PROJECT_NAME}.h\" &lt;&lt;EOF\n#ifndef ${PROJECT_NAME^^}_H\n#define ${PROJECT_NAME^^}_H\n\n\/* Prototypes des fonctions *\/\nvoid ${PROJECT_NAME}_hello(void);\n\n#endif\nEOF\n\n# Cr\u00e9e un fichier source suppl\u00e9mentaire\ncat > \"$SRC_DIR\/${PROJECT_NAME}.c\" &lt;&lt;EOF\n#include &lt;stdio.h>\n#include \"${PROJECT_NAME}.h\"\n\nvoid ${PROJECT_NAME}_hello(void)\n{\n    printf(\"Function from ${PROJECT_NAME}\\\\n\");\n}\nEOF\n\n# Cr\u00e9e le Makefile\ncat > Makefile &lt;&lt;EOF\nCC = gcc\nCFLAGS = -Wall -Wextra -Iinc\/\nLDFLAGS =\nTARGET = bin\/${PROJECT_NAME}\n\nSRC = \\$(wildcard src\/*.c)\nOBJ = \\$(patsubst src\/%.c,bin\/%.o,\\$(SRC))\n\nall: \\$(TARGET)\n\n\\$(TARGET): \\$(OBJ)\n\t\\$(CC) \\$(LDFLAGS) -o \\$@ \\$^\n\nbin\/%.o: src\/%.c\n\t\\$(CC) \\$(CFLAGS) -c -o \\$@ \\$&lt;\n\nclean:\n\trm -f bin\/*.o \\$(TARGET)\n\n.PHONY: all clean\nEOF\n\necho \"Projet C '${PROJECT_NAME}' cr\u00e9\u00e9 avec succ\u00e8s !\"\necho \"Arborescence :\"\ntree<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-2740","page","type-page","status-publish","hentry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/workboot.fr\/ciela\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":null,"_links":{"self":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/2740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/comments?post=2740"}],"version-history":[{"count":1,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/2740\/revisions"}],"predecessor-version":[{"id":2742,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/2740\/revisions\/2742"}],"wp:attachment":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/media?parent=2740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}