Skip to content

Instantly share code, notes, and snippets.

@rajatkhanduja
Created January 30, 2012 08:55
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 rajatkhanduja/1703426 to your computer and use it in GitHub Desktop.
Save rajatkhanduja/1703426 to your computer and use it in GitHub Desktop.
Example of a Makefile to make use of a general rule
SRC = src
OBJ = obj
BIN = bin
CC = gcc
DEFINES =
CFLAGS = -Iinclude/
OBJECTS = ${OBJ}/fsm.o ${OBJ}/set.o ${OBJ}/regex_parser.o ${OBJ}/regex_to_fsm.o ${OBJ}/main.o
all: ${OBJECTS}
${CC} $^ -g -o ${BIN}/lexical_analyzer.out
${OBJ}/%.o : ${SRC}/%.c
${CC} -c -g ${DEFINES} ${CFLAGS} $< -o $@
clean:
rm -f ${OBJ}/*.o
rm -f ${BIN}/*.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment