You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

110 lines
2.4 KiB

  1. #
  2. # Labjack/Nerdjack Tools
  3. # Copyright (c) 2007-2009
  4. # Jim Paris <jim@jtan.com>, Zach Clifford <zacharyc@mit.edu>
  5. #
  6. # This is free software; you can redistribute it and/or modify it and
  7. # it is provided under the terms of version 2 of the GNU General Public
  8. # License as published by the Free Software Foundation; see COPYING.
  9. #
  10. # For Solaris, use: gmake CC=gcc LDFLAGS="-lsocket -lnsl"
  11. # For Windows, build with "make win"
  12. # Build options
  13. CFLAGS += -Wall -g #-pg
  14. LDFLAGS += -lm #-pg
  15. PREFIX = /usr/local
  16. MANPATH = ${PREFIX}/man/man1
  17. BINPATH = ${PREFIX}/bin
  18. WINCC = i386-mingw32-gcc
  19. WINCFLAGS += $(CFLAGS)
  20. WINLDFLAGS += $(LDFLAGS) -lws2_32 -s
  21. # Targets
  22. .PHONY: default
  23. default: lin
  24. .PHONY: all
  25. all: lin win
  26. .PHONY: lin
  27. lin: ljtest ethstream ljconfig \
  28. ethstream.1 ljconfig.1
  29. .PHONY: win
  30. win: ljtest.exe ethstream.exe ljconfig.exe
  31. version.h: VERSION
  32. echo "/* This file was automatically generated. */" >version.h
  33. echo "#define VERSION \"`cat VERSION` (`date +%Y-%m-%d`)\"" >>version.h
  34. # Object files for each executable
  35. obj-common = opt.o ue9.o ue9error.o netutil.o debug.o nerdjack.o
  36. obj-ljconfig = ljconfig.o $(obj-common)
  37. obj-ethstream = ethstream.o $(obj-common)
  38. obj-ljtest = ljtest.o $(obj-common)
  39. ljconfig: $(obj-ljconfig)
  40. ethstream: $(obj-ethstream)
  41. ljtest: $(obj-ljtest)
  42. ljconfig.exe: $(obj-ljconfig:.o=.obj) compat-win32.obj
  43. ethstream.exe: $(obj-ethstream:.o=.obj) compat-win32.obj
  44. ljtest.exe: $(obj-ljtest:.o=.obj) compat-win32.obj
  45. # Manpages
  46. %.1: %
  47. if ! help2man -N --output=$@ ./$< ; then \
  48. echo "No manual page available." > $@ ; fi
  49. %.txt: %.1
  50. nroff -man $< | colcrt | sed s/$$/\\r/ > $@
  51. # Install/uninstall targets for Linux
  52. .PHONY: install
  53. install: ethstream.1 ethstream
  54. install -m 0755 ethstream ${BINPATH}
  55. install -m 0644 ethstream.1 ${MANPATH}
  56. .PHONY: uninstall
  57. uninstall:
  58. rm -f ${BINPATH}/ethstream ${MANPATH}/ethstream.1
  59. # Packaging
  60. PACKAGE=labjack-`cat VERSION`
  61. .PHONY: dist
  62. dist: version.h
  63. mkdir -p ${PACKAGE}
  64. cp [A-Z]* *.[ch] ${PACKAGE}
  65. tar cvzf ${PACKAGE}.tar.gz ${PACKAGE}
  66. rm -r ${PACKAGE}
  67. # Maintenance
  68. .PHONY: clean distclean
  69. clean distclean:
  70. rm -f *.o *.obj *.exe ethstream ljtest ljconfig core *.d *.1 *.txt
  71. # Dependency tracking:
  72. allsources = $(wildcard *.c)
  73. -include $(allsources:.c=.d)
  74. %.o : %.c
  75. $(COMPILE.c) -MP -MMD -MT '$*.obj' -o $@ $<
  76. %.obj : %.c
  77. $(WINCC) $(WINCFLAGS) -MP -MMD -MT '$*.o' -c -o $@ $<
  78. # Win32 executable
  79. %.exe : %.obj
  80. $(WINCC) -o $@ $^ $(WINLDFLAGS)