aboutsummaryrefslogtreecommitdiff
path: root/uip/uip/Makefile.include
blob: 3426dd1fa25875283d7dafce352d24fcf34db960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47


ifdef APPS
  APPDIRS = $(foreach APP, $(APPS), ../apps/$(APP))
  -include $(foreach APP, $(APPS), ../apps/$(APP)/Makefile.$(APP))
  CFLAGS += $(addprefix -I../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 ../lib $(APPDIRS)

$(OBJECTDIR)/%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

$(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 $@ $^