summaryrefslogtreecommitdiff
path: root/apps/system/zmodem/Makefile.host
diff options
context:
space:
mode:
Diffstat (limited to 'apps/system/zmodem/Makefile.host')
-rwxr-xr-xapps/system/zmodem/Makefile.host92
1 files changed, 92 insertions, 0 deletions
diff --git a/apps/system/zmodem/Makefile.host b/apps/system/zmodem/Makefile.host
new file mode 100755
index 000000000..00f28ecec
--- /dev/null
+++ b/apps/system/zmodem/Makefile.host
@@ -0,0 +1,92 @@
+############################################################################
+# apps/system/zmodem/Makefile.host
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+# TOPDIR and APPDIR must be defined on the make command line
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+NUTTXINC = $(TOPDIR)/include
+APPSINC = $(APPDIR)/include
+
+ZMODEM = $(APPDIR)/system/zmodem
+HOSTDIR = $(ZMODEM)/host
+HOSTAPPS = $(ZMODEM)/host/apps
+
+HOSTCFLAGS += -isystem $(HOSTDIR) -I $(ZMODEM)
+HOSTCFLAGS += -Dsz_main=main -Drz_main=main
+ifeq ($(CONFIG_DEBUG),y)
+HOSTCFLAGS += -DCONFIG_DEBUG_ZMODEM=1 -DCONFIG_SYSTEM_ZMODEM_DUMPBUFFER=1
+endif
+
+# Zmodem sz and rz commands
+
+SZSRCS = sz_main.c zm_send.c
+RZSRCS = rz_main.c zm_receive.c
+CMNSRCS = zm_state.c zm_proto.c zm_watchdog.c zm_utils.c zm_dumpbuffer.c
+CMNSRCS += crc16.c crc32.c
+SRCS = $(SZSRCS) $(RZSRCS) $(CMNSRCS)
+
+SZOBJS = $(SZSRCS:.c=$(OBJEXT))
+RZOBJS = $(RZSRCS:.c=$(OBJEXT))
+CMNOBJS = $(CMNSRCS:.c=$(OBJEXT))
+OBJS = $(SRCS:.c=$(OBJEXT))
+
+RZBIN = rz$(EXEEXT)
+SZBIN = sz$(EXEEXT)
+
+VPATH = host
+
+all: $(RZBIN) $(SZBIN)
+.PHONY: clean
+
+$(OBJS): %$(OBJEXT): %.c
+ $(Q) $(HOSTCC) -c $(HOSTCFLAGS) -o $@ $<
+
+$(HOSTAPPS)/zmodem.h: $(APPSINC)/zmodem.h
+ $(Q) cp $(APPSINC)/zmodem.h $(HOSTAPPS)/zmodem.h
+
+$(RZBIN): $(HOSTAPPS)/zmodem.h $(RZOBJS) $(CMNOBJS)
+ $(Q) $(HOSTCC) $(HOSTCFLAGS) -o $@ $(RZOBJS) $(CMNOBJS)
+
+$(SZBIN): $(HOSTAPPS)/zmodem.h $(SZOBJS) $(CMNOBJS)
+ $(Q) $(HOSTCC) $(HOSTCFLAGS) -o $@ $(SZOBJS) $(CMNOBJS)
+
+clean:
+ifneq ($(OBJEXT),)
+ rm -f *$(OBJEXT)
+endif
+ rm -f $(RZBIN) $(SZBIN)
+ rm -f $(HOSTAPPS)/zmodem.h