Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # specify all source files here
- SRCS = a.c b.c
- # specify target here (name of executable)
- TARG = ab
- # specify compiler, compile flags, and needed libs
- CC = gcc
- OPTS = -Wall -O
- LIBS = -lm
- # this translates .c files in src list to .o’s
- OBJS = $(SRCS:.c=.o)
- # all is not really needed, but is used to generate the target
- all: $(TARG)
- # this generates the target executable
- $(TARG): $(OBJS)
- $(CC) -o $(TARG) $(OBJS) $(LIBS)
- # this is a generic rule for .o files
- %.o: %.c
- $(CC) $(OPTS) -c $< -o $@
- # and finally, a clean line
- clean:
- rm -f $(OBJS) $(TARG)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement