Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile for Binary Release #33

Open
5 tasks
Teddy-van-Jerry opened this issue Mar 12, 2023 · 1 comment
Open
5 tasks

Makefile for Binary Release #33

Teddy-van-Jerry opened this issue Mar 12, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request GitHub Actions Related to GitHub Actions (CI/CD) OS: Linux Linux specified issues OS: macOS macOS specified issues
Milestone

Comments

@Teddy-van-Jerry
Copy link
Member

Required Updates

  • Makefile Code Implementation in folder scripts
    • Linux
    • macOS
  • GitHub Actions (CI) Test
  • Related Documentations
@Teddy-van-Jerry Teddy-van-Jerry added enhancement New feature or request OS: Linux Linux specified issues OS: macOS macOS specified issues GitHub Actions Related to GitHub Actions (CI/CD) labels Mar 12, 2023
@Teddy-van-Jerry Teddy-van-Jerry added this to the v1.0 milestone Mar 12, 2023
@Teddy-van-Jerry Teddy-van-Jerry self-assigned this Mar 12, 2023
@Teddy-van-Jerry
Copy link
Member Author

Here is the response of ChatGPT when I ask for an example Makefile for Linux, which can be a reasonable starting point.

Here's a sample Makefile for installing multiple binary files and documentation into appropriate destination directories on a Linux system:

# Makefile for Linux installation
#
# This Makefile installs binary files and documentation to appropriate
# directory locations on a Linux system. It assumes that the binary files
# have already been compiled and are available in the current directory.

# Destination directories for binaries and documentation
BINDIR = /usr/local/bin
MANDIR = /usr/local/share/man/man1

# List of binary files to be installed
BINARIES = program1 program2 program3

# List of manual pages to be installed
MAN_PAGES = program1.1 program2.1 program3.1

# Default target: install all binaries and documentation
all: binaries documentation

# Rule to install all binaries
binaries: $(BINARIES)
        install -m 755 $^ $(BINDIR)

# Rule to install all manual pages
documentation: $(MAN_PAGES)
        install -m 644 $^ $(MANDIR)

# Rule to clean up temporary files
clean:
        rm -f *~ $(BINARIES) $(MAN_PAGES)

# Rule to uninstall binaries and documentation
uninstall:
        rm -f $(addprefix $(BINDIR)/,$(BINARIES)) 
              $(addprefix $(MANDIR)/,$(MAN_PAGES))

Here's an explanation of the important parts of the Makefile:

  • The BINDIR and MANDIR variables specify the destination directories for the binary files and manual pages, respectively.
  • The BINARIES variable lists the names of the binary files to be installed, and the MAN_PAGES variable lists the names of the corresponding manual pages. If you have more than one binary or manual page, simply add more names to the appropriate variable.
  • The binaries rule uses the install command to copy the binary files to the BINDIR directory with file permissions set to 755 (read, write, execute for owner; read, execute for group and others).
  • The documentation rule uses the install command to copy the manual pages to the MANDIR directory with file permissions set to 644 (read and write for owner; read for group and others).
  • The clean rule is used to remove any temporary files that were created during the installation process.
  • The uninstall rule removes the installed binary files and manual pages from their respective directories.

To use the Makefile, simply place it in the same directory as the binary files and manual pages, and run the make command. The make all command will install both the binary files and the manual pages, while the make binaries and make documentation commands will install only the binary files or manual pages, respectively. To uninstall the files, run the make uninstall command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request GitHub Actions Related to GitHub Actions (CI/CD) OS: Linux Linux specified issues OS: macOS macOS specified issues
Projects
Status: Todo
Development

No branches or pull requests

1 participant