######################################################################################
# Purpose : Sample MakeFile that can ber used to build you c code
#
# Author : Saurabh Gupta
#
# Date Created : 25-02-2010
#
# Date Modified : 12-10-2011
#
# Note : 1. make : to build exe
# 2. make static : to build static library (remove main function first)
# 3. make shared : to build shared library (remove main function first)
#
# Usage : change the "EXE" to your program name or else use as it is
######################################################################################
OSTYPE = $(shell uname)
MAKE = make
CC = gcc
LINK = -g -pedantic -Wall -lstdc++ -lpthread -ldl -lm -Wl,-rpath,.
COMPILE = -g -O0 -D_THREAD_SAFE -pedantic -Wall -c -Wno-deprecated
EXE = ./myProgram
static = libmyProgram.a
shared = libmyProgram.so
SRCS = $(shell ls *.c)
OBJS = $(subst .c,.o,$(SRCS))
.SUFFIXES: .o .c
.cpp.o:
$(CC) $(COMPILE) $<
all: $(OBJS)
$(CC) $(OBJS) -o $(EXE) $(LINK)
-include depend.mak
depend:
g++ -MM $(SRCS) > depend.mak
static:
ar -crvs $(a) $(OBJS)
shared: $(OBJS)
$(CC) -shared -Wl,-soname -lc -o $(so) $(OBJS)
clean:
rm -rf $(OBJS) depend.mak $(EXE) $(so) $(a)
# Purpose : Sample MakeFile that can ber used to build you c code
#
# Author : Saurabh Gupta
#
# Date Created : 25-02-2010
#
# Date Modified : 12-10-2011
#
# Note : 1. make : to build exe
# 2. make static : to build static library (remove main function first)
# 3. make shared : to build shared library (remove main function first)
#
# Usage : change the "EXE" to your program name or else use as it is
######################################################################################
OSTYPE = $(shell uname)
MAKE = make
CC = gcc
LINK = -g -pedantic -Wall -lstdc++ -lpthread -ldl -lm -Wl,-rpath,.
COMPILE = -g -O0 -D_THREAD_SAFE -pedantic -Wall -c -Wno-deprecated
EXE = ./myProgram
static = libmyProgram.a
shared = libmyProgram.so
SRCS = $(shell ls *.c)
OBJS = $(subst .c,.o,$(SRCS))
.SUFFIXES: .o .c
.cpp.o:
$(CC) $(COMPILE) $<
all: $(OBJS)
$(CC) $(OBJS) -o $(EXE) $(LINK)
-include depend.mak
depend:
g++ -MM $(SRCS) > depend.mak
static:
ar -crvs $(a) $(OBJS)
shared: $(OBJS)
$(CC) -shared -Wl,-soname -lc -o $(so) $(OBJS)
clean:
rm -rf $(OBJS) depend.mak $(EXE) $(so) $(a)
No comments:
Post a Comment