Advertisement
nezvers

Makefile Gcc template

Mar 10th, 2021
2,263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.59 KB | None | 0 0
  1. # -c<*.o name> <compilation flags>
  2. # -I<search path to include files>
  3. # -L<search path to the lib file>
  4. # -l<libname>
  5.  
  6.  
  7. CC =gcc
  8. CFLAGS =-Wall
  9. INCLUDE=-I ./include
  10. LIB =-L ./lib
  11. LFLAGS =$(LIB) -lopengl32 -lglu32 -lgdi32 -luser32 -lkernel32
  12.  
  13. # trigger the "main" task with just Mingw32-make or just make
  14. all: main
  15.  
  16. main: main.c
  17.     $(CC) $^ -o $@ $(CFLAGS) $(INCLUDE) $(LFLAGS)
  18.     # $^ is dependency list and $@ is action name
  19.  
  20. # %.o means any *.o something is depending, same %.c and %.h are asigned automatically if have the same name
  21. %.o: %.c %.h
  22.     $(CC) -c $^ $(CFLAGS)
  23.  
  24. clean :
  25.     del *.o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement