Skip to content

Commit

Permalink
Move headers from include to include/grass (#1350)
Browse files Browse the repository at this point in the history
The include contained the header files are there directly while distribution
has them in include/grass which is an unnecessary difference.
Having them in a subdirectory can make it easier for code editing tools
and other operations directly running on the source tree. See also:

* https://trac.osgeo.org/grass/wiki/G8SourceLayout

This creates the new grass directory, moves the header files, and
updates build system to use this new layout.
Makefile for makefiles and for header files is now split into two.
  • Loading branch information
wenzeslaus authored Mar 31, 2021
1 parent 27b12e2 commit 61d6f8c
Show file tree
Hide file tree
Showing 110 changed files with 56 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ gui/wxpython/xml/module_tree_menudata.xml
include/Make/Doxyfile_arch_html
include/Make/Doxyfile_arch_latex
include/Make/Platform.make
include/config.h
include/version.h
include/grass/config.h
include/grass/version.h
lib/db/sqlp/sqlp.output
lib/db/sqlp/sqlp.tab.c
lib/db/sqlp/sqlp.tab.h
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ libsclean: cleandistdirs
distclean: clean
-rm -f config.cache config.log config.status config.status.$(ARCH) 2>/dev/null
-rm -f ChangeLog ChangeLog.bak $(ERRORLOG) grass.pc
-rm -f include/config.h include/version.h
-rm -f include/grass/config.h include/grass/version.h
-rm -f include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex 2>/dev/null

include $(MODULE_TOPDIR)/include/Make/Install.make
Expand Down
6 changes: 3 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -14181,7 +14181,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex include/version.h grass.pc include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
trap 'rm -fr `echo "include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex include/grass/version.h grass.pc include/grass/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
Expand Down Expand Up @@ -14435,7 +14435,7 @@ EOF

cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex include/version.h grass.pc"}
CONFIG_FILES=\${CONFIG_FILES-"include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex include/grass/version.h grass.pc"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
Expand Down Expand Up @@ -14516,7 +14516,7 @@ ac_eD='%g'
if test "${CONFIG_HEADERS+set}" != set; then
EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_HEADERS="include/config.h"
CONFIG_HEADERS="include/grass/config.h"
EOF
cat >> $CONFIG_STATUS <<\EOF
fi
Expand Down
4 changes: 2 additions & 2 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $2
AC_INIT(configure.in)
AC_PREREQ(2.13)
AC_PREFIX_DEFAULT(/usr/local)
AC_CONFIG_HEADER(include/config.h)
AC_CONFIG_HEADER(include/grass/config.h)
AC_CANONICAL_HOST
AC_PROG_CC
LOC_EXEEXT
Expand Down Expand Up @@ -1987,7 +1987,7 @@ AC_SUBST(STRIPFLAG)
GRASS_HOME="${DSTDIR}"
AC_SUBST(GRASS_HOME)

AC_OUTPUT(include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex include/version.h grass.pc)
AC_OUTPUT(include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex include/grass/version.h grass.pc)

LOC_MSG([Copying config.status to config.status.${ARCH}])
cp -f config.status config.status.${ARCH}
Expand Down
40 changes: 4 additions & 36 deletions include/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,18 @@ MODULE_TOPDIR = ..
include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Rules.make

SRCH := $(wildcard ../include/*.h ../include/defs/*.h ../include/vect/*.h ../include/iostream/*.h)
DSTH := $(patsubst ../include/%.h,$(ARCH_INCDIR)/%.h,$(SRCH))
DSTH_EXTRA = $(ARCH_INCDIR)/copying.h $(ARCH_INCDIR)/citing.h $(ARCH_INCDIR)/confparms.h

SRCMAKE := $(wildcard ../include/Make/*.make)
DSTMAKE := $(patsubst ../include/Make/%.make,$(ARCH_DISTDIR)/include/Make/%.make,$(SRCMAKE))

default: $(DSTH) $(DSTH_EXTRA) $(DSTMAKE)

# cancel rule from Rules.make
$(ARCH_INCDIR)/%.h: %.h

$(ARCH_INCDIR)/defs/%.h: defs/%.h | $(ARCH_INCDIR)/defs
$(INSTALL_DATA) $< $@

$(ARCH_INCDIR)/vect/%.h: vect/%.h | $(ARCH_INCDIR)/vect
$(INSTALL_DATA) $< $@

$(ARCH_INCDIR)/iostream/%.h: iostream/%.h | $(ARCH_INCDIR)/iostream
$(INSTALL_DATA) $< $@

$(ARCH_INCDIR)/%.h: %.h | $(ARCH_INCDIR)
$(INSTALL_DATA) $< $@

$(ARCH_INCDIR)/defs: | $(ARCH_INCDIR)
$(MKDIR) $@

$(ARCH_INCDIR)/vect: | $(ARCH_INCDIR)
$(MKDIR) $@

$(ARCH_INCDIR)/iostream: | $(ARCH_INCDIR)
$(MKDIR) $@
default: $(DSTMAKE) parsubdirs

$(ARCH_DISTDIR)/include/Make/%.make: Make/%.make | $(ARCH_DISTDIR)/include/Make
$(INSTALL_DATA) $< $@

$(ARCH_DISTDIR)/include/Make:
$(MKDIR) $@

$(ARCH_INCDIR)/copying.h: $(MODULE_TOPDIR)/COPYING | $(ARCH_INCDIR)
sed -e 's/^\(.*\)$$/"\1\\n"/' $< > $@

$(ARCH_INCDIR)/citing.h: $(MODULE_TOPDIR)/CITING | $(ARCH_INCDIR)
sed -e 's/^\(.*\)$$/"\1\\n"/' $< > $@
SUBDIRS = \
grass

$(ARCH_INCDIR)/confparms.h: $(MODULE_TOPDIR)/config.status | $(ARCH_INCDIR)
sed -n '7s/^#\(.*\)$$/"\1"/p' $< > $@
include $(MODULE_TOPDIR)/include/Make/Dir.make
43 changes: 43 additions & 0 deletions include/grass/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
MODULE_TOPDIR = ../..

include $(MODULE_TOPDIR)/include/Make/Vars.make
include $(MODULE_TOPDIR)/include/Make/Rules.make

SRCH := $(wildcard ../../include/grass/*.h ../../include/grass/defs/*.h ../../include/grass/vect/*.h ../../include/grass/iostream/*.h)
DSTH := $(patsubst ../../include/grass/%.h,$(ARCH_INCDIR)/%.h,$(SRCH))
DSTH_EXTRA = $(ARCH_INCDIR)/copying.h $(ARCH_INCDIR)/citing.h $(ARCH_INCDIR)/confparms.h

default: $(DSTH) $(DSTH_EXTRA)

# cancel rule from Rules.make
$(ARCH_INCDIR)/%.h: %.h

$(ARCH_INCDIR)/defs/%.h: defs/%.h | $(ARCH_INCDIR)/defs
$(INSTALL_DATA) $< $@

$(ARCH_INCDIR)/vect/%.h: vect/%.h | $(ARCH_INCDIR)/vect
$(INSTALL_DATA) $< $@

$(ARCH_INCDIR)/iostream/%.h: iostream/%.h | $(ARCH_INCDIR)/iostream
$(INSTALL_DATA) $< $@

$(ARCH_INCDIR)/%.h: %.h | $(ARCH_INCDIR)
$(INSTALL_DATA) $< $@

$(ARCH_INCDIR)/defs: | $(ARCH_INCDIR)
$(MKDIR) $@

$(ARCH_INCDIR)/vect: | $(ARCH_INCDIR)
$(MKDIR) $@

$(ARCH_INCDIR)/iostream: | $(ARCH_INCDIR)
$(MKDIR) $@

$(ARCH_INCDIR)/copying.h: $(MODULE_TOPDIR)/COPYING | $(ARCH_INCDIR)
sed -e 's/^\(.*\)$$/"\1\\n"/' $< > $@

$(ARCH_INCDIR)/citing.h: $(MODULE_TOPDIR)/CITING | $(ARCH_INCDIR)
sed -e 's/^\(.*\)$$/"\1\\n"/' $< > $@

$(ARCH_INCDIR)/confparms.h: $(MODULE_TOPDIR)/config.status | $(ARCH_INCDIR)
sed -n '7s/^#\(.*\)$$/"\1"/p' $< > $@
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion mswindows/osgeo4w/config.h.vc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* include/config.h. modified mingw version for VC */
/* include/grass/config.h. modified mingw version for VC */

/*
* config.h.in
Expand Down

0 comments on commit 61d6f8c

Please sign in to comment.