# include $(OPENAIR_TARGETS)/SIMU/USER/Makerules

OUTDIR = .


libsecu_OBJECTS = \
	kdf.o				\
	key_nas_deriver.o	\
	nas_stream_eea2.o	\
	nas_stream_eia2.o

# pull in dependency info for *existing* .o files
-include $(OUTDIR)/*.d

CFLAGS = \
	-Wall           \
	$(SECU_CFLAGS)  \
	-DENB_MODE      \
	-Werror=uninitialized   \
	-Werror=implicit-function-declaration

$(OUTDIR)/%.o : %.c
	@echo "Compiling $<"
	@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
	@$(CC) -c $(CFLAGS) -o $@ $<
	@$(CC) -MM $(CFLAGS) $< > $(basename $@).d
	@mv -f $(basename $@).d $(basename $@).d.tmp
	@sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
	@sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
	sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
	@rm -f $(basename $@).d.tmp

objsdir:
	@if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;

$(OUTDIR)/libsecu.a: $(addprefix $(OUTDIR)/,$(libsecu_OBJECTS))
	@echo Creating SECU archive
	@$(AR) rcs $@ $(addprefix $(OUTDIR)/,$(libsecu_OBJECTS))

clean:
	@$(RM_F_V) $(OUTDIR)/*.o
	@$(RM_F_V) $(OUTDIR)/*.d
	@$(RM_F_V) $(OUTDIR)/libsecu.a

cleanall: clean