Advertisement
Guest User

Untitled

a guest
May 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # specify all source files here
  2. SRCS = a.c b.c
  3.  
  4. # specify target here (name of executable)
  5. TARG = ab
  6.  
  7. # specify compiler, compile flags, and needed libs
  8. CC = gcc
  9. OPTS = -Wall -O
  10. LIBS = -lm
  11.  
  12. # this translates .c files in src list to .o’s
  13. OBJS = $(SRCS:.c=.o)
  14.  
  15. # all is not really needed, but is used to generate the target
  16. all: $(TARG)
  17.  
  18. # this generates the target executable
  19. $(TARG): $(OBJS)
  20. $(CC) -o $(TARG) $(OBJS) $(LIBS)
  21.  
  22. # this is a generic rule for .o files
  23. %.o: %.c
  24. $(CC) $(OPTS) -c $< -o $@
  25.  
  26. # and finally, a clean line
  27. clean:
  28. rm -f $(OBJS) $(TARG)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement