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.
 
 
 

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