uni

University stuff
git clone git://git.christosmarg.xyz/uni-assignments.git
Log | Files | Refs | README | LICENSE

Makefile (557B)


      1 TARGET = kcombs
      2 
      3 SRC_DIR = src
      4 OBJ_DIR = obj
      5 BIN_DIR = bin
      6 
      7 SRC = $(wildcard $(SRC_DIR)/*.c)
      8 OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
      9 
     10 MOVE = mv
     11 MKDIR_P = mkdir -p
     12 
     13 CC = gcc
     14 CPPFLAGS += -Iinclude
     15 CFLAGS += -Wall
     16 LDFLAGS += -Llib
     17 LDLIBS += -lm
     18 
     19 .PHONY: all clean
     20 
     21 all: $(TARGET)
     22 
     23 $(TARGET): $(OBJ)
     24 	$(MKDIR_P) $(BIN_DIR)
     25 	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
     26 	$(MOVE) $(TARGET) $(BIN_DIR)
     27 
     28 $(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
     29 	$(MKDIR_P) $(OBJ_DIR)
     30 	$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
     31 
     32 run:
     33 	./$(BIN_DIR)/$(TARGET)
     34 
     35 clean:
     36 	$(RM) $(OBJ) $(BIN_DIR)/$(TARGET)