UNAME = $(shell uname -s)

ifeq ($(UNAME),SunOS)
 OS = solaris
endif
ifeq ($(UNAME),Linux)
 OS = linux
endif


## Default configuration setting ##
CC = gcc
CFLAGS = -pipe -g -fpic


PROJ_HOME = .
#BIN_HOME = ${PROJ_HOME}/bin


#all .h file
INC_DIR = -I./include

#libxcode.so depends on OS

PUNYCODE_LIB = ${PROJ_HOME}/lib/$(OS)/libxcode.so 
PUNYCODE_LIB_PATH = ${PROJ_HOME}/lib

#native_unicode file
NATIVE_OBJ_PATH = ${PROJ_HOME}/src
NATIVE_OBJ = $(NATIVE_OBJ_PATH)/native_unicode.o


LIB = $(PUNYCODE_LIB) $(NATIVE_OBJ) -L${PUNYCODE_LIB_PATH}

########################
#   Source File Name   #
########################
TAR = fcc_c
SRC = $(NATIVE_OBJ_PATH)/$(TAR).c

########################


all: clean native_unicode punycode

punycode: 
	$(CC) ${CFLAGS}  $(INC_DIR) $(LIB) $(SRC) -o $(TAR) 
		
native_unicode:					
	$(CC) ${CFLAGS} -c $(NATIVE_OBJ_PATH)/native_unicode.c $(INC_DIR)
	mv native_unicode.o $(NATIVE_OBJ_PATH)/
clean:	
	rm -rf $(TAR) core
		
