Skip to content

Instantly share code, notes, and snippets.

@LordAmit
Created July 6, 2013 14:12
Show Gist options
  • Save LordAmit/5940007 to your computer and use it in GitHub Desktop.
Save LordAmit/5940007 to your computer and use it in GitHub Desktop.
My first make file that worked as I wanted. Will use this for future references.
CC = gcc
CFLAGS = -lm
all: mm1
backup:
cd .. && zip chap1_c_backup.zip chap1_c/*
mm1: lcgrand.o mm1.o
@echo making everything nice and sweet to mm1
gcc -o mm1 mm1.o lcgrand.o -lm
lcgrand.o: lcgrand.c
@echo compiling lcgrand.c file to lcgrand.o
gcc -c lcgrand.c
mm1.o: mm1.c
@echo compiling mm1.c file to object file mm1.o
gcc -c mm1.c
clean:
@echo removing garbages
rm mm1.o lcgrand.o mm1
help:
@echo type make help for this message
@echo type make clean to clean object files
@echo type make backup to make backup file of this work folder
@echo type make mm1 to make executable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment