Advertisement
tepples

Sample makefile

Aug 20th, 2014
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # This one is untested, but it roughly matches the structure I use in my NES makefiles
  2.  
  3. objlist := chat draw config gui cJSON text squirrel eventcmd fnmatch
  4. program_title = chat
  5.  
  6. CC := gcc
  7. LD := gcc
  8. CFLAGS := -Wall -Wextra -std=gnu99
  9. LDFLAGS := -Wl,-subsystem,windows
  10. LDLIBS := -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_net -lSDL2_ttf -lsquirrel -lsqstdlib
  11. objdir := obj/win32
  12. srcdir := src
  13. objlisto := $(foreach o,$(objlist),$(objdir)/$(o).o)
  14.  
  15. .PHONY: clean
  16.  
  17. program_title: $(objlisto) src/spark.res
  18.     $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  19.  
  20. $(objdir)/%.o: $(srcdir)/%.c
  21.     $(CC) $(CFLAGS) $< -o $@
  22.  
  23. clean:
  24.     -rm $(objdir)/*.o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement