summaryrefslogblamecommitdiff
path: root/src/common/Makefile.in
blob: c778ff17bb9830a1d263ec3d226502aba58dcbae (plain) (tree)
1
2
3
4
5
6
7
8
 
                                                                                          

                                                                                              

                                                                                                     

                                    



                              



                                                    






                                                                                                                   


                           
                                     



                               
                  
 

          




                                                                     
                   



                   

                                   













                                                                     
 
        

                                

        





                                                
 



                                                        
 
                                                                                
 
                                                          
 
                                                          

                                                                                                            
 
                                                              

                                                                                                                       
 
                                                           

                                                                                            
 
 


                                            


                                            
COMMON_OBJ = obj_all/core.o obj_all/socket.o obj_all/timer.o obj_all/db.o obj_all/lock.o \
	obj_all/nullpo.o obj_all/malloc.o obj_all/showmsg.o obj_all/strlib.o obj_all/utils.o \
	obj_all/grfio.o obj_all/mapindex.o obj_all/ers.o obj_all/md5calc.o \
	obj_all/minicore.o obj_all/minisocket.o obj_all/minimalloc.o obj_all/random.o obj_all/des.o \
	obj_all/conf.o

COMMON_H = $(shell ls ../common/*.h)

COMMON_SQL_OBJ = obj_sql/sql.o
COMMON_SQL_H = sql.h

MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar

LIBCONFIG_OBJ = ../../3rdparty/libconfig/libconfig.o ../../3rdparty/libconfig/grammar.o \
	../../3rdparty/libconfig/scanctx.o ../../3rdparty/libconfig/scanner.o ../../3rdparty/libconfig/strbuf.o
LIBCONFIG_H = ../../3rdparty/libconfig/libconfig.h ../../3rdparty/libconfig/grammar.h \
	../../3rdparty/libconfig/parsectx.h ../../3rdparty/libconfig/scanctx.h ../../3rdparty/libconfig/scanner.h \
	../../3rdparty/libconfig/strbuf.h ../../3rdparty/libconfig/wincompat.h
LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig

HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
	ALL_DEPENDS=txt sql
	SQL_DEPENDS=common common_sql
else
	ALL_TARGET=txt
	SQL_DEPENDS=needs_mysql
endif
TXT_DEPENDS=common

@SET_MAKE@

#####################################################################
.PHONY : all txt sql clean help

all: $(ALL_DEPENDS)

txt: $(TXT_DEPENDS)

sql: $(SQL_DEPENDS)

clean:
	@echo "	CLEAN	common"
	@rm -rf *.o obj_all obj_sql

help:
	@echo "possible targets are 'txt' 'sql' 'all' 'clean' 'help'"
	@echo "'txt'    - builds object files used in txt servers"
	@echo "'sql'    - builds object files used in sql servers"
	@echo "'all'    - builds all above targets"
	@echo "'clean'  - cleans builds and objects"
	@echo "'help'   - outputs this message"

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

needs_mysql:
	@echo "MySQL not found or disabled by the configure script"
	@exit 1

obj_all:
	@echo "	MKDIR	obj_all"
	@-mkdir obj_all

obj_sql:
	@echo "	MKDIR	obj_sql"
	@-mkdir obj_sql

obj_all/common.a: $(COMMON_OBJ)
	@echo "	AR	$@"
	@@AR@ rcs obj_all/common.a $(COMMON_OBJ)

obj_sql/common_sql.a: $(COMMON_SQL_OBJ)
	@echo "	AR	$@"
	@@AR@ rcs obj_sql/common_sql.a $(COMMON_SQL_OBJ)
                

common: obj_all $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common.a

common_sql: obj_sql $(COMMON_SQL_OBJ) obj_sql/common_sql.a

obj_all/%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
	@echo "	CC	$<"
	@@CC@ @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @LDFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<

obj_all/mini%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
	@echo "	CC	$<"
	@@CC@ @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DMINICORE @LDFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<

obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H) $(LIBCONFIG_H)
	@echo "	CC	$<"
	@@CC@ @CFLAGS@ $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<


# missing object files
MT19937AR_OBJ:
	@$(MAKE) -C ../../3rdparty/mt19937ar

LIBCONFIG_OBJ:
	@$(MAKE) -C ../../3rdparty/libconfig