Guest User

Untitled

a guest
Jan 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. OBJCFLAGS = -lobjc -framework Foundation
  2. CFLAGS = -fblocks
  3. CXXFLAGS =
  4. DEPS = mylog.h
  5. EXES = test_objc test_c test_cpp \
  6. mem_leak_objc mem_leak_objc_gc mem_leak_c mem_leak_cpp
  7.  
  8. .PHONY: all clean
  9.  
  10. .SUFFIXES: .c .cpp .m .o
  11.  
  12. # These make an executable from file with the same name but with the given
  13. # extension. These are already defined by make, but I'm changing the order of
  14. # args a little:
  15.  
  16. # Although .m: is defined by make, it doesn't take $(OBJCFLAGS) into account
  17. # for whatever reason, so the Cocoa and Objective-C libs don't get linked in.
  18. .m: $(DEPS)
  19. gcc -o $@ $< $(OBJCFLAGS)
  20.  
  21. .c: $(DEPS)
  22. gcc -o $@ $< $(CFLAGS)
  23.  
  24. .cpp: $(DEPS)
  25. g++ -o $@ $< $(CXXFLAGS)
  26.  
  27. # We can also use lines like .m.o: to handle making .o files from .m files.
  28.  
  29.  
  30.  
  31. all: $(EXES)
  32.  
  33. $(EXES): $(DEPS)
  34.  
  35. # TODO: How do we make it so that each executable depends on a similarly-named
  36. # source file? Right now, if there's a name in $(EXES) that doesn't exist in
  37. # source form, make treats the target as already done.
  38.  
  39. clean:
  40. -rm -f $(EXES)
Add Comment
Please, Sign In to add comment