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.
 
 
 

111 lines
2.3 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 += #-pg
  15. LDLIBS += -lm
  16. PREFIX = /usr/local
  17. MANPATH = ${PREFIX}/man/man1/
  18. BINPATH = ${PREFIX}/bin
  19. #WINCC = i386-mingw32-gcc
  20. WINCC = i586-mingw32msvc-gcc
  21. WINCFLAGS += $(CFLAGS)
  22. WINLDFLAGS += $(LDFLAGS) -lws2_32 -liphlpapi -s
  23. # Targets
  24. .PHONY: default
  25. default: lin
  26. .PHONY: all
  27. all: lin win
  28. .PHONY: lin
  29. lin: ethstream ethstream.1 ethstream.txt
  30. .PHONY: win
  31. win: ethstream.exe
  32. version.h: VERSION
  33. echo "/* This file was automatically generated. */" >version.h
  34. echo "#define VERSION \"`cat VERSION` (`date +%Y-%m-%d`)\"" >>version.h
  35. # Object files for each executable
  36. obj-common = opt.o ue9.o ue9error.o netutil.o debug.o nerdjack.o
  37. obj-ethstream = ethstream.o $(obj-common)
  38. ethstream: $(obj-ethstream)
  39. $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  40. ethstream.exe: $(obj-ethstream:.o=.obj) compat-win32.obj
  41. # Manpages
  42. %.1: %
  43. if ! help2man -N --output=$@ ./$< ; then \
  44. echo "No manual page available." > $@ ; fi
  45. %.txt: %.1
  46. nroff -man $< | colcrt | sed s/$$/\\r/ > $@
  47. # Install/uninstall targets for Linux
  48. .PHONY: install
  49. install: ethstream.1 ethstream
  50. mkdir -p ${BINPATH} ${MANPATH}
  51. install -m 0755 ethstream ${BINPATH}
  52. install -m 0644 ethstream.1 ${MANPATH}
  53. .PHONY: uninstall
  54. uninstall:
  55. rm -f ${BINPATH}/ethstream ${MANPATH}/ethstream.1
  56. # Packaging
  57. PACKAGE=labjack-`cat VERSION`
  58. .PHONY: dist
  59. dist: version.h
  60. mkdir -p ${PACKAGE}
  61. cp [A-Z]* *.[ch] ${PACKAGE}
  62. tar cvzf ${PACKAGE}.tar.gz ${PACKAGE}
  63. rm -r ${PACKAGE}
  64. # Maintenance
  65. .PHONY: clean distclean
  66. clean distclean:
  67. rm -f *.o *.obj *.exe ethstream core *.d *.dobj *.1 *.txt
  68. # Dependency tracking:
  69. allsources = $(wildcard *.c)
  70. -include $(allsources:.c=.d)
  71. %.o : %.c
  72. $(COMPILE.c) -MP -MMD -MT '$*.o' -MF '$*.d' -o $@ $<
  73. -include $(allsources:.c=.dobj)
  74. %.obj : %.c
  75. $(WINCC) $(WINCFLAGS) -MP -MMD -MT '$*.obj' -MF '$*.dobj' -c -o $@ $<
  76. # Win32 executable
  77. %.exe : %.obj
  78. $(WINCC) -o $@ $^ $(WINLDFLAGS)