include ../config.mk

CFLAGS = $(COMMON_CFLAGS) -Wno-strict-overflow -fPIC -I. -I../common -I../modem -I../modem/freedv -I../datalink_arq -I../data_interfaces

.PHONY: all freedv 

all: freedv modem.o framer.o channel_busy.o

freedv:
	$(MAKE) -C freedv

modem.o: modem.c modem.h
	$(CC) $(CFLAGS) -c modem.c

channel_busy.o: channel_busy.c channel_busy.h
	$(CC) $(CFLAGS) -c channel_busy.c

framer.o: framer.c framer.h
	$(CC) $(CFLAGS) -c framer.c

clean:
	$(MAKE) -C freedv clean
	rm -f *.o *.d

# Pull in the header dependencies generated by -MMD (see config.mk).  Include
# only the .d files next to the objects THIS Makefile compiles (modem.o,
# framer.o, channel_busy.o): paths inside a .d are relative to the directory
# the compiler ran in, so they only resolve correctly from the Makefile that
# built them.  The freedv objects are built by the freedv sub-make, whose own
# -include covers them.
-include $(wildcard *.d)
