Skip to content

terminal-42s/42gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

42gen (42 Project Starter Generator)

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.

Contents

Quick Start

git clone https://github.com/terminal-42s/42gen
cd 42gen
make
./42gen --help

Generate your first project:

./42gen minishell

What It Generates

For a project named myproject, 42gen creates:

myproject/
├── src/
│   ├── main.c
│   └── utils.c
├── include/
│   └── myproject.h
├── Makefile
├── README.md
├── author
└── .gitignore

Git Integration

  • Automatically initializes a git repository
  • Adds generated files and creates an initial commit

Default Makefile Flags

  • -Wall -Wextra -Werror
  • -Iinclude

Templates

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 and Usage

Build the generator:

make

Run 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

Safety Checks

  • 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

Repository Structure

.
├── include/
│   └── 42gen.h
├── src/
│   ├── generator.c
│   ├── main.c
│   └── utils.c
├── Makefile
└── README.md

Makefile Targets

  • 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

Roadmap

  • Add --bonus and --git options
  • Add norminette template support
  • Add GUI mode (SDL2 or webview)
  • Add cross-platform installer (Linux, macOS, Windows)

Contributing

Contributions are welcome. Fork the repo, make improvements, and open a pull request.

License

MIT License.

About

42gen is a lightweight CLI tool that instantly generates clean, 42-compliant C project structures with Makefile, headers, and source files, helping students focus on coding instead of setup

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors