Makfile-Generator
Generate a generic Makefile for C or C++ projects.
Features
write make in a Makefile file and a generic code will be created.
CC = g++
CFLAGS = -Wall -Wextra -g
EXTENSION = .cc
HEADER_EXTENSION = .h
OBJECT_EXTENSION = .o
INCLUDE_PATH = include
TARGET = main
SRCDIR = src
OBJDIR = obj
BINDIR = bin
SOURCES := $(wildcard $(SRCDIR)/*$(EXTENSION))
INCLUDES := $(wildcard $(INCLUDE_PATH)/*$(HEADER_EXTENSION))
OBJECTS := $(SOURCES:$(SRCDIR)/%$(EXTENSION)=$(OBJDIR)/%$(OBJECT_EXTENSION))
all: $(BINDIR)/$(TARGET)
@echo 'Ca marche bro!'
$(BINDIR)/$(TARGET): $(OBJECTS)
mkdir -p $(BINDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
$(OBJECTS): $(OBJDIR)/%$(OBJECT_EXTENSION) : $(SRCDIR)/%$(EXTENSION)
mkdir -p $(OBJDIR)
$(CC) -o $@ -c $< $(CFLAGS) -I$(INCLUDE_PATH)
clean:
rm -f $(OBJDIR)/*$(OBJECT_EXTENSION)
rm -f $(BINDIR)/$(TARGET)
| |