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.
 
 
 

107 lines
2.2 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. WINCC = i586-mingw32msvc-gcc
  20. WINCFLAGS += $(CFLAGS)
  21. WINLDFLAGS += $(LDFLAGS) -lws2_32 -liphlpapi -s
  22. # Targets
  23. .PHONY: default
  24. default: lin
  25. .PHONY: all
  26. all: lin win
  27. .PHONY: lin
  28. lin: ethstream ethstream.1 ethstream.txt
  29. .PHONY: win
  30. win: ethstream.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-ethstream = ethstream.o $(obj-common)
  37. ethstream: $(obj-ethstream)
  38. ethstream.exe: $(obj-ethstream:.o=.obj) compat-win32.obj
  39. # Manpages
  40. %.1: %
  41. if ! help2man -N --output=$@ ./$< ; then \
  42. echo "No manual page available." > $@ ; fi
  43. %.txt: %.1
  44. nroff -man $< | colcrt | sed s/$$/\\r/ > $@
  45. # Install/uninstall targets for Linux
  46. .PHONY: install
  47. install: ethstream.1 ethstream
  48. install -m 0755 ethstream ${BINPATH}
  49. install -m 0644 ethstream.1 ${MANPATH}
  50. .PHONY: uninstall
  51. uninstall:
  52. rm -f ${BINPATH}/ethstream ${MANPATH}/ethstream.1
  53. # Packaging
  54. PACKAGE=labjack-`cat VERSION`
  55. .PHONY: dist
  56. dist: version.h
  57. mkdir -p ${PACKAGE}
  58. cp [A-Z]* *.[ch] ${PACKAGE}
  59. tar cvzf ${PACKAGE}.tar.gz ${PACKAGE}
  60. rm -r ${PACKAGE}
  61. # Maintenance
  62. .PHONY: clean distclean
  63. clean distclean:
  64. rm -f *.o *.obj *.exe ethstream core *.d *.dobj *.1 *.txt
  65. # Dependency tracking:
  66. allsources = $(wildcard *.c)
  67. -include $(allsources:.c=.d)
  68. %.o : %.c
  69. $(COMPILE.c) -MP -MMD -MT '$*.o' -MF '$*.d' -o $@ $<
  70. -include $(allsources:.c=.dobj)
  71. %.obj : %.c
  72. $(WINCC) $(WINCFLAGS) -MP -MMD -MT '$*.obj' -MF '$*.dobj' -c -o $@ $<
  73. # Win32 executable
  74. %.exe : %.obj
  75. $(WINCC) -o $@ $^ $(WINLDFLAGS)