42gen is a C command-line generator for 42 school projects. It creates a clean project skeleton with a standard 42 layout and a ready-to-use Makefile.
- Quick Start
- What It Generates
- Templates
- Build and Usage
- Safety Checks
- Repository Structure
- Makefile Targets
- Roadmap
- Contributing
- License
git clone https://github.com/terminal-42s/42gen
cd 42gen
make
./42gen --helpGenerate your first project:
./42gen minishellFor a project named myproject, 42gen creates:
myproject/
├── src/
│ ├── main.c
│ └── utils.c
├── include/
│ └── myproject.h
├── Makefile
├── README.md
├── author
└── .gitignore
- Automatically initializes a git repository
- Adds generated files and creates an initial commit
- -Wall -Wextra -Werror
- -Iinclude
| Template name | Extra generated files |
|---|---|
| minishell | parser.c, executor.c, builtins.c |
| push_swap | sort.c, stack_ops.c |
| cub3d | render.c, map.c |
| ft_printf | ft_printf.c |
| get_next_line, gnl | get_next_line.c |
| so_long | game.c, map_parser.c |
| philosophers, philo | philosopher.c, monitor.c |
| ft_irc, irc | server.c, commands.c |
| webserv | server.cpp, request.cpp (C++) |
| cpp_module..., cpp... | main.cpp, class.cpp (C++) |
Build the generator:
makeRun it:
./42gen <project_name>Examples:
./42gen minishell
./42gen push_swap
./42gen cub3d
./42gen ft_printf
./42gen gnl
./42gen so_long
./42gen philosophers
./42gen ft_irc
./42gen webserv
./42gen cpp_module01
./42gen myproject- Accepts only names matching [A-Za-z0-9_-]
- Prevents overwriting an existing directory
- Uses safer functions like snprintf and strncpy
- Cleans up partially created files on failure
- Includes built-in --help output
.
├── include/
│ └── 42gen.h
├── src/
│ ├── generator.c
│ ├── main.c
│ └── utils.c
├── Makefile
└── README.md
- make or make default: Build the generator
- make 42gen: Compile only the 42gen binary
- make clean: Remove object files
- make fclean: Remove object files and binary
- make re: Rebuild from scratch
- make linux, make mac, make windows: OS-specific stubs
- Add --bonus and --git options
- Add norminette template support
- Add GUI mode (SDL2 or webview)
- Add cross-platform installer (Linux, macOS, Windows)
Contributions are welcome. Fork the repo, make improvements, and open a pull request.
MIT License.