#
# modules/stellaris/Makefile
#
# Build the iRODS stellaris module
#

ifndef buildDir
buildDir = $(CURDIR)/../..
endif

include $(buildDir)/config/config.mk
include $(buildDir)/config/platform.mk
include $(buildDir)/config/directories.mk
include $(buildDir)/config/common.mk


#
# Directories
#
MSObjDir =	$(modulesDir)/stellaris/microservices/obj
MSSrcDir =	$(modulesDir)/stellaris/microservices/src
MSIncDir =	$(modulesDir)/stellaris/microservices/include


#
# Objects
#
OBJECTS =	$(MSObjDir)/stellarisMS.o



#
# Include flags
#
INCLUDE_FLAGS =	-I$(MSIncDir)


#
# Include files and libraries for curl and redland rdf libs
# Until they are set up by the main configure script you can run 
# curl-config and raptor-config on your platform to get the values below.
#
LIBS = -L/usr/lib64 -lcurl -lidn -lssl -lcrypto -ldl -lz -lraptor

#
# Compile and link flags
#
INCLUDES +=	$(INCLUDE_FLAGS) $(LIB_INCLUDES) $(SVR_INCLUDES)
CFLAGS_OPTIONS := $(CFLAGS) $(MY_CFLAG)
CFLAGS =	$(CFLAGS_OPTIONS) $(INCLUDES) $(MODULE_CFLAGS)


.PHONY: all rules microservices server client clean
.PHONY: server_ldflags client_ldflags server_cflags client_cflags
.PHONY: print_cflags

# Build everything
all:	microservices
	@true

# List module's objects for inclusion in the clients
client_ldflags:
	@true

# List module's includes for inclusion in the clients
client_cflags:
	@true

# List module's objects for inclusion in the server
server_ldflags:
	@echo $(OBJECTS) $(LIBS)

# List module's includes for inclusion in the server
server_cflags:
	@echo $(INCLUDE_FLAGS)

# Build microservices
microservices:	print_cflags $(OBJECTS)
	@true

# Build client additions
client:
	@true

# Build server additions
server:
	@true

# Build rules
rules:
	@true

# Clean
clean:
	@echo "Clean stellaris module..."
	@rm -f $(OBJECTS)


# Show compile flags
print_cflags:
	@echo "Compile flags:"
	@echo "    $(CFLAGS_OPTIONS)"


#
# Compilation targets
#
$(OBJECTS): $(MSObjDir)/%.o: $(MSSrcDir)/%.c $(DEPEND)
	@echo "Compile stellaris module `basename $@`..."
	@$(CC) -c $(CFLAGS) -o $@ $<
