Skip to content

Instantly share code, notes, and snippets.

@dstndstn
Created August 31, 2018 14:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstndstn/0492f69eb27a11cdd622d01105643dd0 to your computer and use it in GitHub Desktop.
Save dstndstn/0492f69eb27a11cdd622d01105643dd0 to your computer and use it in GitHub Desktop.
A diff against wcslib-5.19.1 to allow parallel builds (eg, -j8) to work
diff --git a/C/GNUmakefile b/C/GNUmakefile
index eec9389..4631b63 100644
--- a/C/GNUmakefile
+++ b/C/GNUmakefile
@@ -50,8 +50,7 @@ else
endif
endif
-# For building the sharable library.
-PICLIB := libwcs-PIC.a
+PICMODULES := $(patsubst %.o,%-pic.o,$(MODULES))
CPPFLAGS += -I. -I..
@@ -59,7 +58,6 @@ vpath %.c test
vpath %.h ..
vpath %.in ..
-
# For building and exercising the test suite
# ------------------------------------------
# Test programs that don't require CFITSIO or PGPLOT...
@@ -121,17 +119,11 @@ else
cp flexed/$@ .
endif
-$(WCSLIB)(%.o) : %.c
- -@ echo ''
- $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
- $(AR) r$(ARFLAGS) $(WCSLIB) $%
- -@ $(RM) $%
+%.o: %.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-$(PICLIB)(%.o) : %.c
- -@ echo ''
- $(CC) $(CPPFLAGS) $(CFLAGS) $(SHRFLAGS) -c $<
- $(AR) r$(ARFLAGS) $(PICLIB) $%
- -@ $(RM) $%
+%-pic.o: %.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(SHRFLAGS) -c $< -o $@
%.i : %.c
-@ echo ''
@@ -236,21 +228,12 @@ build : lib
lib : $(FLEXMODS) $(WCSLIB) $(SHRLIB)
-$(WCSLIB) : $(MODULES:%=$(WCSLIB)(%))
- -@ echo ''
- $(RANLIB) $@
-
-$(SHRLIB) : $(PICLIB)
- -@ echo ''
- -@ $(RM) -r tmp
- mkdir tmp && \
- cd tmp && \
- trap 'cd .. ; $(RM) -r tmp' 0 1 2 3 15 ; \
- $(AR) x ../$(PICLIB) && \
- $(SHRLD) -o $@ *.o $(LDFLAGS) $(LIBS) && \
- mv $@ ..
+$(WCSLIB) : $(MODULES)
+ $(AR) rc$(ARFLAGS) $@ $^
+ $(RANLIB) $@
-$(PICLIB) : $(MODULES:%.o=$(PICLIB)(%.o)) ;
+$(SHRLIB) : $(PICMODULES)
+ $(SHRLD) -o $@ $^ $(LDFLAGS) $(LIBS)
install : build
- if [ ! -d "$(LIBDIR)" ] ; then \
@@ -298,7 +281,7 @@ cleaner : clean
cleanest distclean realclean : cleaner
- $(RM) ../wcsconfig.h ../wcsconfig_tests.h
- $(RM) fitshdr.c wcsbth.c wcspih.c wcsulex.c wcsutrn.c
- - $(RM) $(PICLIB) libwcs-*.a libwcs.so.* libwcs.*.dylib
+ - $(RM) libwcs-*.a libwcs.so.* libwcs.*.dylib
check test : tests $(TESTS:%=run_%)
@@ -379,41 +362,42 @@ GNUmakefile : ../makedefs ;
show ::
-@ -@ echo ' FLEXMODS := $(FLEXMODS)'
-@ -@ echo ' MODULES := $(MODULES)'
+ -@ -@ echo ' PICMODULES := $(PICMODULES)'
# Dependencies (use the %.d pattern rule to list them)
#-----------------------------------------------------
-$(WCSLIB)(cel.o) : cel.h prj.h sph.h wcsconfig.h wcserr.h wcsmath.h \
+cel.c : cel.h prj.h sph.h wcsconfig.h wcserr.h wcsmath.h \
wcsprintf.h wcstrig.h
-$(WCSLIB)(fitshdr.o) : wcsconfig.h fitshdr.h wcsutil.h
-$(WCSLIB)(dis.o) : dis.h wcserr.h wcsprintf.h wcsutil.h
-$(WCSLIB)(lin.o) : dis.h lin.h wcserr.h wcsprintf.h
-$(WCSLIB)(log.o) : log.h
-$(WCSLIB)(prj.o) : prj.h wcsconfig.h wcserr.h wcsmath.h wcsprintf.h \
+fitshdr.c : wcsconfig.h fitshdr.h wcsutil.h
+dis.c : dis.h wcserr.h wcsprintf.h wcsutil.h
+lin.c : dis.h lin.h wcserr.h wcsprintf.h
+log.c : log.h
+prj.c : prj.h wcsconfig.h wcserr.h wcsmath.h wcsprintf.h \
wcstrig.h wcsutil.h
-$(WCSLIB)(spc.o) : spc.h spx.h wcsconfig.h wcserr.h wcsmath.h \
+spc.c : spc.h spx.h wcsconfig.h wcserr.h wcsmath.h \
wcsprintf.h wcstrig.h wcsutil.h
-$(WCSLIB)(sph.o) : sph.h wcsconfig.h wcstrig.h
-$(WCSLIB)(spx.o) : spx.h wcserr.h wcsmath.h
-$(WCSLIB)(tab.o) : tab.h wcserr.h wcsmath.h wcsprintf.h wcsutil.h
-$(WCSLIB)(wcs.o) : cel.h dis.h lin.h log.h prj.h spc.h sph.h spx.h \
+sph.c : sph.h wcsconfig.h wcstrig.h
+spx.c : spx.h wcserr.h wcsmath.h
+tab.c : tab.h wcserr.h wcsmath.h wcsprintf.h wcsutil.h
+wcs.c : cel.h dis.h lin.h log.h prj.h spc.h sph.h spx.h \
tab.h wcs.h wcsconfig.h wcserr.h wcsmath.h \
wcsprintf.h wcstrig.h wcsunits.h wcsutil.h
-$(WCSLIB)(wcsbth.o) : cel.h lin.h prj.h spc.h spx.h wcs.h wcshdr.h \
+wcsbth.c : cel.h lin.h prj.h spc.h spx.h wcs.h wcshdr.h \
wcsmath.h wcsprintf.h wcsutil.h
-$(WCSLIB)(wcserr.o) : wcserr.h wcsprintf.h
-$(WCSLIB)(wcsfix.o) : cel.h lin.h prj.h spc.h sph.h spx.h wcs.h wcserr.h \
+wcserr.c : wcserr.h wcsprintf.h
+wcsfix.c : cel.h lin.h prj.h spc.h sph.h spx.h wcs.h wcserr.h \
wcsfix.h wcsmath.h wcsunits.h wcsutil.h
-$(WCSLIB)(wcshdr.o) : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \
+wcshdr.c : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \
wcshdr.h wcsmath.h wcsutil.h
-$(WCSLIB)(wcspih.o) : cel.h lin.h prj.h spc.h spx.h wcs.h wcshdr.h \
+wcspih.c : cel.h lin.h prj.h spc.h spx.h wcs.h wcshdr.h \
wcsmath.h wcsprintf.h wcsutil.h
-$(WCSLIB)(wcsprintf.o): wcsprintf.h
-$(WCSLIB)(wcstrig.o) : wcsconfig.h wcsmath.h wcstrig.h
-$(WCSLIB)(wcsulex.o) : wcserr.h wcsmath.h wcsunits.h wcsutil.h
-$(WCSLIB)(wcsunits.o) : wcserr.h wcsunits.h
-$(WCSLIB)(wcsutil.o) : wcsmath.h wcsutil.h
-$(WCSLIB)(wcsutrn.o) : wcserr.h wcsunits.h
+wcsprintf.c: wcsprintf.h
+wcstrig.c : wcsconfig.h wcsmath.h wcstrig.h
+wcsulex.c : wcserr.h wcsmath.h wcsunits.h wcsutil.h
+wcsunits.c : wcserr.h wcsunits.h
+wcsutil.c : wcsmath.h wcsutil.h
+wcsutrn.c : wcserr.h wcsunits.h
tbth1 tbth1_cfitsio : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcsconfig.h \
wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment