Skip to content

Instantly share code, notes, and snippets.

@basharam
Last active August 29, 2015 13:57
Show Gist options
  • Save basharam/9511863 to your computer and use it in GitHub Desktop.
Save basharam/9511863 to your computer and use it in GitHub Desktop.
Makefile template in parent directory to invoke makefile in subdirectories
STATIC_LIB1 = foldername1
STATIC_LIB2 = foldername2
STATIC_LIB3 = foldername3
DYNAMIC_DLL = foldername4
RUN_SH_SCRIPT= foldername5
#$(LIBPCAP_LINUX)
ALL_TARGETS=$(RUN_SH_SCRIPT)\
$(STATIC_LIB1) $(STATIC_LIB2) $(STATIC_LIB3) $(DYNAMIC_DLL)
.PHONY: $(RUN_SH_SCRIPT)
$(RUN_SH_SCRIPT):
./testscript.sh
# test script example :
#-------testscript.sh--------------------------
#| # bin/sh! |
#| cd foldername5 |
#| pwd |
#| echo "Clean last build\n" |
#| make clean |
#| ./configure |
#| echo "call make \n" |
#| make |
#----------------------------------------------
#.PHONY: $(STATIC_LIB1)
#$(STATIC_LIB1):
#@$(MAKE) -C $@;
.PHONY: $(STATIC_LIB2)
$(STATIC_LIB2):
@$(MAKE) -C $@;
.PHONY: $(STATIC_LIB3)
$(STATIC_LIB3):
@$(MAKE) -C $@;
.PHONY: $(DYNAMIC_DLL)
$(DYNAMIC_DLL):
@$(MAKE) -C $@;
.PHONY: all
all:$(ALL_TARGETS)
.PHONY: clean
clean :
rm -f $(STATIC_LIB1)/obj/*.o $(STATIC_LIB1)/lib/*.a
rm -f $(STATIC_LIB2)/obj/*.o $(STATIC_LIB2)/lib/*.a
rm -f $(STATIC_LIB3)/obj/*.o $(STATIC_LIB3)/lib/*.a
rm -f $(DYNAMIC_DLL)/obj/*.o $(DYNAMIC_DLL)/bin/*.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment