Created
December 6, 2023 18:08
-
-
Save siddontang/9c5601034311d882150153d107ffeb02 to your computer and use it in GitHub Desktop.
Support pre-build in Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Refer to https://stackoverflow.com/questions/1612278/pre-build-step-in-makefile | |
CC=gcc | |
.PHONY: all clean | |
.SECONDARY: main-build | |
all: pre-build main-build | |
pre-build: | |
@echo PRE | |
post-build: | |
@echo POST | |
main-build: target | |
target: $(OBJS) | |
$(CC) -o $@ $(OBJS) | |
@$(MAKE) --no-print-directory post-build | |
clean: | |
rm -f $(OBJS) target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment