Makefile-ccan 740 B

1234567891011121314151617181920212223
  1. # Example makefile which makes a "libccan.a" of everything under ccan/.
  2. # For simple projects you could just do:
  3. # SRCFILES += $(wildcard ccan/*/[a-z]*.c)
  4. CFLAGS=-g -O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I. $(DEPGEN)
  5. # Automatic dependency generation: makes ccan/*.d files.
  6. DEPGEN=-MD
  7. -include ccan/*.d
  8. # Every directory with .c files (other than _info.c) is included.
  9. DIRS=$(patsubst %/, %, $(sort $(dir $(wildcard ccan/*/[a-z]*.c))))
  10. # We compile all the ccan/foo/*.o files together into ccan/foo.o
  11. OBJFILES=$(DIRS:=.o)
  12. libccan.a: $(OBJFILES)
  13. $(AR) r $@ $^
  14. # Dependencies are autogenerated in the .d files.
  15. $(OBJFILES): %.o:
  16. $(CC) $(CFLAGS) -c -o $@ $*/[a-z]*.c