pflarue / ardop

ardopcf - A multi-platform implementation of the Amateur Radio Digital Open Protocol (ARDOP)
Other
30 stars 7 forks source link

Move ARDOPC/ → src/ and move Makefile to root #69

Closed cbs228 closed 4 months ago

cbs228 commented 4 months ago

I believe this is the reorg that was discussed in this thread. @pflarue, can you see how this looks and how badly I managed to break Windows this time?

This PR depends on, and includes, PR #68.


The ARDOPC/ directory is no longer necessary and is removed. C sources are reorganized under a new top-level src/ directory. The Makefile is relocated to the repository root for easy access.

Remove the vpath make definitions. This eliminates potential filename conflicts. Instead, each file should be listed by its full path relative to the Makefile directory. (i.e., the repo root.)

The src/ directory is now the root of the -I include path for all ARDOPC sources. Include paths should be relative to either:

All includes in ARDOPC/ should now be relative to one of those two places. This avoids weird relative paths like:

#include "../lib/something/else.h"   /* deprecated */

and also minimizes the number of -I include paths we have to set.

Includes within src/ are rewritten to use the full path in every include, like:

#include "common/version.h"

instead of

#include "version.h"

This is less ambiguous and more robust.

The lib sources are not affected by any of these changes and are untouched.

We split sources that are platform-specific out into their own subdirectory. Additional suggestions for subdirectory organization are welcome.

A very pleasant side-effect is that the top-level directory is much less cluttered after a build. The executable ends up in the repo root.

Eventually there will be a test/ directory for unit tests.

pflarue commented 4 months ago

I like this new layout.

So far, I've found only one minor change needed in lib/rawhid/rawhid.c #include "../../ARDOPCommonCode/ardopcommon.h" should be #include "common/ardopcommon.h"

for consistency (also in lib/rawhid/rawhid.c) #include "../hid/hidapi.h" should also be #include "hid/hidapi.h"

However, this pattern of defining includes with respect to src/ and lib/ while using -Isrc and -Ilib in the Makefile currently breaks the linter in my source code editor. It stops with "No such file or directory" when it first encounters one of these includes. Hopefully I can figure out how to adjust the linter to handle these correctly, because this is a very useful tool.

pflarue commented 4 months ago

I made the minor changes to rawhid.c in the branch for this pull request. I also resolved the difficulties that I was having the my linter.

@cbs228: Thanks for this change. I think it greatly improves the structure of the repository.

I have verified that after these changes ardopcf compiles, runs, and allows produces a successful connection to a Winlink gateway using both Linux and Windows. Thus, I'll be merging it into the develop branch. Additional testing will be done to check for breakage due to this and the many other changes currently in the develop branch before these are merged into the master branch for the next release of ardopcf.