Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.37 KB | None | 0 0
  1. # See gcc/clang manual to understand all flags
  2. CFLAGS += -std=c99 # Define which version of the C standard to use
  3. CFLAGS += -Wall # Enable the 'all' set of warnings
  4. CFLAGS += -Werror # Treat all warnings as error
  5. CFLAGS += -Wshadow # Warn when shadowing variables
  6. CFLAGS += -Wextra # Enable additional warnings
  7. CFLAGS += -O2 -D_FORTIFY_SOURCE=2 # Add canary code, i.e. detect buffer overflows
  8. CFLAGS += -fstack-protector-all # Add canary code to detect stack smashing
  9. CFLAGS += -D_POSIX_C_SOURCE=201112L -D_XOPEN_SOURCE # feature_test_macros for getpot and getaddrinfo
  10.  
  11. LCFLAGS = -lz
  12. CC = gcc
  13. TESTS = tests/
  14.  
  15. all: receiver sender clean
  16.  
  17. sender: sender.o socket.h packet.o
  18.     @$(CC) -c sender.c -o sender.o $(CFLAGS) $(LCFLAGS)
  19.     @$(CC) sender.o packet.o -o sender $(CFLAGS) $(LCFLAGS)
  20.  
  21. receiver: receiver.o socket.h packet.o
  22.     @$(CC) -c receiver.c -o receiver.o $(CFLAGS) $(LCFLAGS)
  23.     @$(CC) receiver.o packet.o -o receiver $(CFLAGS) $(LCFLAGS)
  24.  
  25. packet.o: packet_interface.h packet_implem.c
  26.     @$(CC) -c packet_implem.c -o packet.o $(CFLAGS) $(LDFLAGS)
  27.  
  28. tests: linksim maketest
  29.  
  30. linksim:
  31.     cd $(TESTS)LINGI1341-linksim-master && make
  32.  
  33. maketest:
  34.     cd $(TESTS) && make
  35.  
  36. clean:
  37.     @rm -f *.o  *.o
  38.  
  39. mrproper: clean
  40.     @rm -f receiver sender
  41.     @rm -f $(TESTS)*.log $(TESTS)received_file $(TESTS)input_file
  42.     @rm -f *.log received_file input_file
  43.  
  44. .PHONY: tests
  45. .PHONY: compile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement