makefile 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html
  2. # the compiler: gcc for C programs, defined as g++ for c++
  3. CC = g++
  4. #compiler flags:
  5. # -g adds debugging information to the executable file
  6. # -Wall turns off most, but not all compiler warnings
  7. CFLAGS = -std=c++14
  8. # define any libraries
  9. LIBS = -lwebsockets -lpthread
  10. # define the source files
  11. SRCS = websocket.cpp main.cpp chatcommand.cpp chatcommand_addchatroom.cpp chatcommand_adduser.cpp chatcommand_getchatroomlist.cpp chatcommand_getusers.cpp chatcommand_getusersinchatroom.cpp chatcommand_joinchatroom.cpp chatcommand_joinsimplegame.cpp chatcommand_leavechatroom.cpp chatcommand_leavesimplegame.cpp chatcommand_login.cpp chatcommand_logout.cpp chatcommand_nop.cpp chatcommand_removechatroom.cpp chatcommand_removeuser.cpp chatcommand_send.cpp chatcommand_sendto.cpp chatcommand_sendtoall.cpp chatcommand_simplegamechat.cpp chatcommand_simplegamesetdata.cpp chatcommand_simplegameusergetdata.cpp chatcommand_simplegameusersetdata.cpp chatcommand_simplegameusers.cpp chatcommand_startsimplegame.cpp chatclient.cpp chatroom.cpp datablock.cpp datastring.cpp Debug.cpp error_signals.cpp idisposable.cpp message.cpp parameters.cpp sha256.cpp simplechatgame.cpp simplechatgameuser.cpp StackTrace.cpp stringbuilder.cpp task.cpp tasks.cpp test.cpp user.cpp
  12. # define the object files
  13. OBJS = $(SRCS:.cpp=.o)
  14. # define the main executable file
  15. MAIN = websocket
  16. # The following part of the makefile is generic.
  17. # It can be used to make any executable just by changing the definitions above.
  18. .PHONY: depend clean
  19. all: $(MAIN)
  20. @echo websocket has been compiled
  21. $(MAIN): $(OBJS)
  22. $(CC) $(CFLAGS) -o $(MAIN) $(OBJS) $(LIBS)
  23. # this is a suffix replacement rule for building .o's from .c's
  24. # it uses automatic variables $<: the name of the prerequisite of
  25. # the rule (a .cpp file) and $@: the name of the target of the rule (a .o file)
  26. # (see the gnu make manual about automatic variables)
  27. .cpp.o:
  28. $(CC) $(CFLAGS) -c $< -o $@
  29. clean:
  30. $(RM) *.o *~ $(MAIN)
  31. depend: $(SRCS)
  32. makedepend $^
  33. # DO NOT DELETE THIS LINE -- make depend needs it