Skip to content

Conversation

kobenairb
Copy link
Contributor

@kobenairb kobenairb commented Apr 10, 2023

Hi all,

Some small improvements for constify. I slighty optimized the Makefile and remove useless new lines in constify.c when printing version.

In this optimized version, I made the following improvements:

  • Consolidated common flags into CFLAGS and DEFINES variables
  • Uses := instead of = for variable assignment to prevent unnecessary re-evaluation.
  • Uses $(shell date +%Y%m%d) instead of invoking the date command multiple times.
  • Moved the platform-specific LIBS flag into an ifeq block for better readability
  • Simplified the object file generation rule to use a pattern rule instead of repeating the recipe for each object file
  • Added quotes around $@ and $< in recipe commands to handle filenames with spaces (maybe useful for Windows target)
  • Added dependencies for the install target to ensure that the executable is built before it's copied to the destination directory

For the constify.c source file, I just removed the \n\n for the PrintVersion function.

@kobenairb kobenairb changed the title Optimize constify Makefile Remove extra new line when version is printed, optimize Makefile as well Apr 10, 2023
@kobenairb kobenairb changed the title Remove extra new line when version is printed, optimize Makefile as well constify: Remove extra new line when version is printed, optimize Makefile as well Apr 10, 2023
@RetroAntho RetroAntho merged commit 6b5aff1 into alekmaul:develop Apr 10, 2023
@kobenairb kobenairb deleted the makefile_constify branch April 13, 2023 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants