diff --git a/Makefile.Win b/Makefile.Win new file mode 100644 index 0000000..52934e5 --- /dev/null +++ b/Makefile.Win @@ -0,0 +1,82 @@ +############################################################# +# TO BE CHANGED BY EACH USER TO POINT TO include/ AND lib/ +# DIRS HOLDING CFITSIO *.h AND libcfitsio IF THEY ARE NOT IN +# THE STANDARD PLACES +# + +CFITSIOINCDIR = E:\\Programs\\msys64\\mingw64\\include +LIBDIR = E:\\Programs\\msys64\\mingw64\\lib +BINDIR = E:\\Programs\\msys64\\mingw64\\bin + +# +# +############################################################# +# COMPILATION OPTIONS BELOW +# + +# another good memory checker is valgrind : http://valgrind.kde.org/index.html +# valgrind --tool=memcheck hotpants + +# for memory checking with libefence +# LIBS = -L$(LIBDIR) -lm -lcfitsio -lefence + +# for profiling with gprof +# COPTS = -pg -fprofile-arcs -funroll-loops -O3 -ansi -pedantic-errors -Wall -I$(CFITSIOINCDIR) + +# for gdbugging +# COPTS = -g3 -funroll-loops -O3 -ansi -pedantic-errors -Wall -I$(CFITSIOINCDIR) + +# standard usage +# recently added -std=c99 after a bug report +COPTS = -funroll-loops -fcommon -O3 -ansi -std=c99 -pedantic-errors -Wall -I$(CFITSIOINCDIR) -D_GNU_SOURCE -DSIZEOF_VOID_P=8 -DMS_WIN64 -static +LIBS = -L$(LIBDIR) -lm -lcfitsio -L$(LBINDIR) -lz + +# compiler +CC = gcc + +# +# +############################################################# +# BELOW SHOULD BE OK, UNLESS YOU WANT TO COPY THE EXECUTABLES +# SOMEPLACE AFTER THEY ARE BUILT eg. hotpants +# + +STDH = functions.h globals.h defaults.h +ALL = main.o vargs.o alard.o functions.o + +all: hotpants extractkern maskim + +hotpants: $(ALL) + $(CC) $(ALL) -o hotpants $(LIBS) $(COPTS) +# cp hotpants ../../bin/$(ARCH) + +main.o: $(STDH) main.c + $(CC) $(COPTS) -c main.c + +alard.o: $(STDH) alard.c + $(CC) $(COPTS) -c alard.c + +functions.o: $(STDH) functions.c + $(CC) $(COPTS) -c functions.c + +vargs.o: $(STDH) vargs.c + $(CC) $(COPTS) -c vargs.c + +extractkern : extractkern.o + $(CC) extractkern.o -o extractkern $(LIBS) $(COPTS) + +extractkern.o : $(STDH) extractkern.c + $(CC) $(COPTS) -c extractkern.c + +maskim : maskim.o + $(CC) maskim.o -o maskim $(LIBS) $(COPTS) + +maskim.o: $(STDH) maskim.c + $(CC) $(COPTS) -c maskim.c + +clean : + rm -f *.o + rm -f *~ .*~ + rm -f hotpants + rm -f extractkern + rm -f maskim diff --git a/main.c b/main.c index 2d8d44c..2d749f7 100644 --- a/main.c +++ b/main.c @@ -12,6 +12,12 @@ #include "globals.h" #include "functions.h" + +#ifdef __MINGW32__ +#include +#endif + + int main(int argc,char *argv[]) { int i,j,k,l,m; /* generic indices */ char scrStr[SCRLEN]; /* scratch string */ @@ -248,7 +254,13 @@ int main(int argc,char *argv[]) { fits_write_key_str(oPtr, "AUTHOR", "unknown", "Who ran the software", &status); /* host name */ - if (!gethostname(hInfo, 80)) +#ifdef __MINGW32__ + strncpy(hInfo, "Unknown", sizeof(hInfo)/sizeof(char)); +#else + gethostname(hInfo, 80); +#endif + + if (hInfo) fits_write_key_str(oPtr, "ORIGIN", hInfo, "Where it was done", &status); /* what was it fired up */