aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile.include
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2019-03-13 02:50:42 -0400
committerB. Watson <yalhcru@gmail.com>2019-03-13 02:50:42 -0400
commit2973d0c78e9b8eed3c5af239927c6bd36af64604 (patch)
treea0fdfe7201303edd11c6d86015ef4f79796fcf0f /src/Makefile.include
downloadfujichat-2973d0c78e9b8eed3c5af239927c6bd36af64604.tar.gz
initial commit
Diffstat (limited to 'src/Makefile.include')
-rw-r--r--src/Makefile.include47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Makefile.include b/src/Makefile.include
new file mode 100644
index 0000000..05ce291
--- /dev/null
+++ b/src/Makefile.include
@@ -0,0 +1,47 @@
+
+
+ifdef APPS
+ APPDIRS = $(foreach APP, $(APPS), ../uip/apps/$(APP))
+ -include $(foreach APP, $(APPS), ../uip/apps/$(APP)/Makefile.$(APP))
+ CFLAGS += $(addprefix -I../uip/apps/,$(APPS))
+endif
+
+ifndef CCDEP
+ CCDEP = $(CC)
+endif
+ifndef CCDEPCFLAGS
+ CCDEPCFLAGS = $(CFLAGS)
+endif
+ifndef OBJECTDIR
+ OBJECTDIR = obj
+endif
+
+ifeq (${wildcard $(OBJECTDIR)},)
+ DUMMY := ${shell mkdir $(OBJECTDIR)}
+endif
+
+
+vpath %.c . ../uip/uip ../uip/lib $(APPDIRS)
+
+$(OBJECTDIR)/%.o: %.c
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+$(OBJECTDIR)/%.d: %.c
+ @set -e; rm -f $@; \
+ $(CCDEP) -MM $(CCDEPCFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,$(OBJECTDIR)/\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+UIP_SOURCES=uip.c uip_arp.c uiplib.c psock.c timer.c uip-neighbor.c
+
+
+ifneq ($(MAKECMDGOALS),clean)
+-include $(addprefix $(OBJECTDIR)/,$(UIP_SOURCES:.c=.d) \
+ $(APP_SOURCES:.c=.d))
+endif
+
+uip.a: ${addprefix $(OBJECTDIR)/, $(UIP_SOURCES:.c=.o)}
+ $(AR) a $@ $^
+
+apps.a: ${addprefix $(OBJECTDIR)/, $(APP_SOURCES:.c=.o)}
+ $(AR) a $@ $^