File indexing completed on 2024-04-28 03:42:51

0001 #
0002 # Makefile to build data file test utilities
0003 #
0004 # Build the target tools to build programs used to test data files
0005 #
0006 # Begin Date: 2nd July 2008
0007 # Author: Akarsh Simha <akarshsimha@gmail.com>
0008 # License: GPL
0009 #
0010 
0011 #                ACHTUNG! DIESES MAKEFILE IST KAPUT.
0012 #
0013 # NOTE: This is a extremely non-portable Makefile, just like the rest
0014 # of the files in this directory. Most likely, it will not work out of
0015 # the box on your computer. Here's what you might need to do:
0016 #
0017 # 1. Ensure you're running GNU/Linux or other POSIX compliant OS. Else
0018 # ask some leet guru how to get this to work on your platform.
0019 # 2. Check if you have mysql_config in the same place as defined in MYSQL_CONFIG
0020 # 3. Define the variables KSTARS_MYSQL_DB_USER and KSTARS_MYSQL_DB_DB
0021 # which specify which user and database you want to use on your
0022 # *local* MySQL server. Everything here assumes localhost. If you
0023 # can't run MySQL off localhost, fix that in all those C programs.
0024 # 4. Ensure you have libhtmesh.a from KStars' build of libhtmesh at
0025 # $KDEINSTALLDIR/lib/libhtmesh.a
0026 #
0027 # TODO:
0028 # 1. Make HTMesh a shared object library
0029 # 2. Consider migrating to CMake and being part of the buildsystem of
0030 # KStars.
0031 #
0032 # My lack of experience and know-how of buildsystems doesn't help
0033 # here. If you can fix this, please do. -- Akarsh
0034 #
0035 # If you need any information, please feel free to contact me at
0036 # <akarsh.simha@kdemail.net> or <akarshsimha@gmail.com>
0037 
0038 
0039 MYSQL_CONFIG=/usr/bin/mysql_config
0040 KSTARS_MYSQL_DB_TO_BIN=./mysql2bin
0041 KSTARS_NOMAD_MYSQL_DB_TO_BIN=./nomadmysql2bin
0042 KSTARS_MYSQL_DB_DB=$(KSTARS_MYSQL_DB_USER)
0043 KSTARS_MYSQL_DB_TBL=tycho2
0044 KSTARS_NOMAD_MYSQL_DB_TBL=nomad
0045 
0046 all: mysql2bin binfiletester nomadbinfiletester nomadmysql2bin-merge nomadmysql2bin-split
0047 
0048 mysql2bin: mysql2bin.c
0049         $(CC) $(CFLAGS) `$(MYSQL_CONFIG) --cflags` $@.c $(LDFLAGS) `$(MYSQL_CONFIG) --libs` -o $@
0050 
0051 nomadmysql2bin: nomadmysql2bin.c
0052         $(CC) $(CFLAGS) `$(MYSQL_CONFIG) --cflags` $@.c $(LDFLAGS) `$(MYSQL_CONFIG) --libs` -o $@
0053 
0054 nomadbinfile2mysql: nomadbinfile2mysql.cpp
0055         $(CXX) -D_FILE_OFFSET_BITS=64 $(CXXFLAGS) -I../../htmesh -I../.. `$(MYSQL_CONFIG) --cflags` $@.cpp $(LDFLAGS) `$(MYSQL_CONFIG) --libs` $(KDEINSTALLDIR)/lib/libhtmesh.a -o $@
0056 
0057 nomadmysql2bin-split: nomadmysql2bin-split.c
0058         $(CC) -D_FILE_OFFSET_BITS=64 $(CFLAGS) `$(MYSQL_CONFIG) --cflags` $@.c $(LDFLAGS) `$(MYSQL_CONFIG) --libs` -o $@
0059 
0060 nomadmysql2bin-merge: nomadmysql2bin-merge.c
0061         $(CC) -D_FILE_OFFSET_BITS=64 $(CFLAGS) $@.c $(LDFLAGS) -lm -o $@
0062 
0063 binfiletester: binfiletester.c
0064         $(CC) $(CFLAGS) $@.c $(LDFLAGS) -lm -o $@
0065 
0066 nomadbinfiletester: nomadbinfiletester.c
0067         $(CC) -D_FILE_OFFSET_BITS=64 $(CFLAGS) $@.c $(LDFLAGS) -lm -o $@
0068 
0069 readnomadbindump: readnomadbindump.c
0070         $(CC) -D_FILE_OFFSET_BITS=64 $(CFLAGS) $@.c $(LDFLAGS) -lm -o $@
0071 
0072 nomadbinfile2sqlite: nomadbinfile2sqlite.cpp
0073         $(CXX) -D_FILE_OFFSET_BITS=64 $(CXXFLAGS) -l sqlite3 -I../../htmesh -I../..  nomadbinfile2sqlite.cpp $(KDEINSTALLDIR)/lib/libhtmesh.a -o $@
0074 clean:
0075         -rm binfiletester mysql2bin nomadmysql2bin nomadmysql2bin-split nomadmysql2bin-merge nomadbinfiletester readnomadbindump nomadbinfile2mysql
0076         -rm ushf usdf nshf nsdf nf dsdf dshf
0077 
0078 datafiles: mysql2bin
0079         echo "If this step hangs, please reduce the value of MYSQL_STARS_PER_QUERY in mysql2bin.c and try again."
0080         ./mysql2bin $(KSTARS_MYSQL_DB_USER) $(KSTARS_MYSQL_DB_PASS) $(KSTARS_MYSQL_DB_DB) usdf ushf dsdf dshf nsdf nshf nf Henry-Draper.idx $(KSTARS_MYSQL_DB_TBL)
0081         cat ushf usdf > ../unnamedstars.dat
0082         cat nshf nsdf > ../namedstars.dat
0083         cat dshf dsdf > ../deepstars.dat
0084         cat nf > ../starnames.dat
0085         rm ushf usdf nshf nsdf nf dsdf dshf
0086 
0087 nomaddatafiles: nomadmysql2bin
0088         echo "If this step hangs, please reduce the value of MYSQL_STARS_PER_QUERY in nomadmysql2bin.c and try again."
0089         ./nomadmysql2bin $(KSTARS_MYSQL_DB_USER) $(KSTARS_MYSQL_DB_PASS) usdf ushf $(KSTARS_MYSQL_DB_DB) $(KSTARS_NOMAD_MYSQL_DB_TBL)
0090         cat ushf usdf > USNO-NOMAD-1e8.dat    # TODO: Change
0091         rm ushf usdf
0092 
0093 install:
0094 # Install nothing