Advertisement
Wildtide

Zorba's Frame Makefile

Jun 26th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.93 KB | None | 0 0
  1. FRAME_LIB = lib/LibFrame.a
  2. C_FILES := $(wildcard src/*.cpp)
  3. OBJS := $(patsubst src/%.cpp, build/%.o, $(C_FILES))
  4. INCDIRS = -I./include -I../include
  5. CC = cc
  6. CFLAGS = -Wall $(INCDIRS)
  7. LDFLAGS =
  8. AR = ar
  9.        
  10. all: $(FRAME_LIB)
  11.  
  12. $(FRAME_LIB): .depend $(OBJS)
  13.     $(AR) rcs $(FRAME_LIB) $(OBJS)
  14. #   $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(PROGRAM)
  15.  
  16. depend: .depend
  17.  
  18. .depend: cmd = gcc $(INCDIRS) -MM -MF depend $(var); cat depend >> .depend;
  19. .depend:
  20.     @echo "Generating dependencies..."
  21.     @$(foreach var, $(C_FILES), $(cmd))
  22.     @rm -f depend
  23.  
  24. -include .depend
  25.  
  26. # These are the pattern matching rules. In addition to the automatic
  27. # variables used here, the variable $* that matches whatever % stands for
  28. # can be useful in special cases.
  29. %.o: %.c
  30.     $(CC) $(CFLAGS) -c $< -o $@
  31.  
  32. build/%.o: src/%.cpp
  33.     $(CC) $(CFLAGS) -c $< -o $@
  34.  
  35. %: %.c
  36.     $(CC) $(CFLAGS) -o $@ $<
  37.  
  38. clean:
  39.     rm -f .depend build/*.o $(FRAME_LIB)
  40.  
  41. .PHONY: clean depend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement