Last active
February 9, 2019 22:14
-
-
Save nmelihsensoy/de67d0a139d1acb6ff7400b0d28313c6 to your computer and use it in GitHub Desktop.
Makefile for C/C++ App
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
| # | |
| # Project Structure | |
| # | |
| # project_folder | |
| # | | |
| # |_____Makefile | |
| # | | |
| # |_____src | |
| # | |__app.c | |
| # | | |
| # |_____obj | |
| # | |__app.o | |
| # | | |
| # |_____bin | |
| # |__app -> Executable | |
| # | |
| CC = gcc | |
| CFLAGS = -Wall | |
| LIBS = -lm | |
| SRC_DIR = src | |
| OBJ_DIR = obj | |
| BIN_DIR = bin | |
| APP_NAME = app | |
| $(BIN_DIR)/$(APP_NAME): $(OBJ_DIR)/$(APP_NAME).o | |
| $(CC) $(CFLAGS) $(LIBS) -o $(BIN_DIR)/$(APP_NAME) $(OBJ_DIR)/$(APP_NAME).o | |
| $(OBJ_DIR)/$(APP_NAME).o: $(SRC_DIR)/$(APP_NAME).c | |
| $(CC) $(CFLAGS) -c $(SRC_DIR)/$(APP_NAME).c -o $(OBJ_DIR)/$(APP_NAME).o | |
| clean: | |
| rm -f $(OBJ_DIR)/*.o | |
| install: | |
| cp $(APP_NAME) /usr/bin | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment