I2C toy code
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

75 рядки
2.5 KiB

  1. # MAKEFILE for linux GCC
  2. #
  3. # This makefile produces a shared object and requires libtool to be installed.
  4. #
  5. # Thanks to Zed Shaw for helping debug this on BSD/OSX.
  6. # Tom St Denis
  7. #
  8. # (GNU make only)
  9. ### USAGE:
  10. #
  11. # CFLAGS="-DUSE_LTM -DLTM_DESC -I/path/to/libtommath" make -f makefile.shared all EXTRALIBS=/path/to/libtommath/libtommath.a
  12. # ./test
  13. # make -f makefile.shared PREFIX=/opt/libtom install
  14. #
  15. PLATFORM := $(shell uname | sed -e 's/_.*//')
  16. ifndef LT
  17. ifeq ($(PLATFORM), Darwin)
  18. LT:=glibtool
  19. else
  20. LT:=libtool
  21. endif
  22. endif
  23. LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
  24. INSTALL_CMD = $(LT) --mode=install install
  25. UNINSTALL_CMD = $(LT) --mode=uninstall rm
  26. #Output filenames for various targets.
  27. ifndef LIBNAME
  28. LIBNAME=libtomcrypt.la
  29. endif
  30. include makefile_include.mk
  31. #ciphers come in two flavours... enc+dec and enc
  32. src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
  33. $(LTCOMPILE) $(LTC_CFLAGS) $(CPPFLAGS) $(LTC_LDFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
  34. .c.o:
  35. $(LTCOMPILE) $(LTC_CFLAGS) $(CPPFLAGS) $(LTC_LDFLAGS) -o $@ -c $<
  36. LOBJECTS = $(OBJECTS:.o=.lo)
  37. $(LIBNAME): $(OBJECTS)
  38. $(LT) --mode=link --tag=CC $(CC) $(LTC_CFLAGS) $(CPPFLAGS) $(LTC_LDFLAGS) $(LOBJECTS) $(EXTRALIBS) -o $@ -rpath $(LIBPATH) -version-info $(VERSION_LT)
  39. test: $(call print-help,test,Builds the library and the 'test' application to run all self-tests) $(LIBNAME) $(TOBJECTS)
  40. $(LT) --mode=link --tag=CC $(CC) $(LTC_CFLAGS) $(CPPFLAGS) $(LTC_LDFLAGS) -o $(TEST) $(TOBJECTS) $(LIBNAME) $(EXTRALIBS)
  41. # build the demos from a template
  42. define DEMO_template
  43. $(1): $(call print-help,$(1),Builds the library and the '$(1)' demo) demos/$(1).o $$(LIBNAME)
  44. $$(LT) --mode=link --tag=CC $$(CC) $$(LTC_CFLAGS) $$(CPPFLAGS) $$(LTC_LDFLAGS) $$^ $$(EXTRALIBS) -o $(1)
  45. endef
  46. $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
  47. install: $(call print-help,install,Installs the library, headers and pkd-config file) .common_install
  48. sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' libtomcrypt.pc.in > libtomcrypt.pc
  49. install -d $(DESTDIR)$(LIBPATH)/pkgconfig
  50. install -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
  51. install_bins: $(call print-help,install_bins,Installs the useful demos ($(USEFUL_DEMOS))) .common_install_bins
  52. uninstall: $(call print-help,uninstall,Uninstalls the library, headers and pkd-config file) .common_uninstall
  53. rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtomcrypt.pc
  54. # ref: $Format:%D$
  55. # git commit: $Format:%H$
  56. # commit time: $Format:%ai$