uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

Makefile (602B)


      1 TARGET = minecurses
      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 CC = gcc
     11 CPPFLAGS += -Iinclude
     12 CFLAGS += -Wall 
     13 LDFLAGS += -Llib
     14 LDLIBS += -lm -lncurses -lSDL2 -lSDL2_mixer -pthread
     15 
     16 MOVE = mv
     17 MKDIR_P = mkdir -p
     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)