Created
April 29, 2020 09:51
-
-
Save quocle108/e85b22009f7d6b0384ccda7ba846f246 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Specify the source files, target files, the build directories, | |
| # and the install directory | |
| SOURCES = phone.cpp | |
| OBJECTS = $(SOURCES:.cpp=.o) | |
| OUTPUTFILE = phone | |
| LIBSTATIC = libhardware.a | |
| LIBDYNAMIC = libsoftware.dylib | |
| STATICDIR = ../staticlib | |
| DYNAMICDIR = ../dynamiclib | |
| INSTALLDIR = ../binaries | |
| # | |
| # Add the parent directory as an include path | |
| # | |
| CFLAGS += -I ../staticlib/include -I ../dynamiclib/include | |
| # | |
| # Default target | |
| # | |
| .PHONY: all | |
| all: $(OUTPUTFILE) | |
| # | |
| # Target to build the executable. | |
| # | |
| $(OUTPUTFILE): $(OBJECTS) \ | |
| $(STATICDIR)/$(LIBSTATIC) \ | |
| $(DYNAMICDIR)/$(LIBDYNAMIC) | |
| g++ $(LDFLAGS) -o $@ $^ | |
| .cpp.o: $(SOURCES) | |
| g++ $(CFLAGS) -c -o $@ $< | |
| .PHONY: install | |
| install: | |
| mkdir -p $(INSTALLDIR) | |
| cp -p $(OUTPUTFILE) $(INSTALLDIR) | |
| .PHONY: clean | |
| clean: | |
| rm -f *.o | |
| rm -f $(OUTPUTFILE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment