daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 11 in 6 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # The C compiler
  2. CC = gcc
  3. # Compiler arguments
  4. CFLAGS =
  5. # Linker arguments
  6. LDFLAGS = -lncurses
  7.  
  8. # Source directory
  9. SRC_DIR = src
  10. # Object files directory
  11. OBJ_DIR = obj
  12. # Binary directory
  13. BIN_DIR = bin
  14. # Name of the final binary
  15. BINARY_NAME = osp
  16.  
  17. # List of source files, SRC_DIR is the root path
  18. SOURCES = main.c test.c
  19.  
  20. # Prefixed list of c source files, example: src/main.c
  21. SRC = $(addprefix $(SRC_DIR)/,$(SOURCES))
  22. # Prefixed list of object files, example: obj/main.o
  23. OBJ = $(addprefix $(OBJ_DIR)/,$(SOURCES:.c=.o))
  24.  
  25. # The default make rule
  26. .PHONY: default
  27. default: $(BIN_DIR)/$(BINARY_NAME)
  28.  
  29. # Link object files to the binary
  30. $(BIN_DIR)/$(BINARY_NAME): $(OBJ)
  31.     @mkdir -p $(BIN_DIR)
  32.     $(CC) $(LDFLAGS) -o $@ $^
  33.  
  34. # Generate object files from source file list
  35. $(OBJ_DIR)/%.o:
  36.     @mkdir -p $(OBJ_DIR)
  37.     $(CC) $(CFLAGS) -c -o $@ ___ # <--- problem here
  38.  
  39. # Run the binary after it was created
  40. .PHONY: run
  41. run: $(BINARY_NAME)
  42.     ./$(BIN_DIR)/$(BINARY_NAME)
  43.  
  44. # Clean the object and binary directories
  45. .PHONY: clean
  46. clean:
  47.     rm -f $(OBJ_DIR)/* $(BIN_DIR)/*
  48.  
  49. # Empty rule to stop make from trying to remake the makefile
  50. Makefile: ;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top