Skip to content

Instantly share code, notes, and snippets.

@daniellimws
Created March 20, 2018 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniellimws/b91bc309b01714d1396e8e8b5244dea9 to your computer and use it in GitHub Desktop.
Save daniellimws/b91bc309b01714d1396e8e8b5244dea9 to your computer and use it in GitHub Desktop.
Simple Makefile template
# Macros ========================================
CC=g++
CFLAGS=-Wall -Wextra -Werror -std=c++11 -pedantic
OBJECTS=insert.objects
EXE=insert.exe.name
ERASE=rm
MAKE=make
# Targets ========================================
$(EXE) : $(OBJECTS)
$(CC) -o $(EXE) $(OBJECTS)
$(OUTDIR)%.o : %.cpp
$(CC) $(CFLAGS) -c $< -o $@
$(OUTDIR)%.o : %.cpp %.h
$(CC) $(CFLAGS) -c $< -o $@
clean :
$(ERASE) $(OBJECTS) $(EXE)
rebuild :
$(ERASE) $(OBJECTS) $(EXE)
$(MAKE) -f Makefile -i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment