2019-05-03 19:56:03 -05:00
|
|
|
CC = g++
|
2018-07-27 23:54:52 -05:00
|
|
|
CFLAGS = -g -O0 -w
|
2019-05-04 00:03:04 -05:00
|
|
|
LFLAGS = -g -O0
|
|
|
|
INC_FLAGS = -fpermissive
|
2018-07-27 23:54:52 -05:00
|
|
|
|
2019-05-03 19:56:03 -05:00
|
|
|
OBJ_DIR = OBJ
|
|
|
|
SRC_DIR = SRC
|
|
|
|
LIB_DIR = -L.
|
|
|
|
LIB = -lm
|
|
|
|
|
2018-07-27 23:54:52 -05:00
|
|
|
EXE = ace
|
|
|
|
|
2019-05-04 00:03:04 -05:00
|
|
|
#ABC_DIR = ../abc_with_bb_support
|
|
|
|
ABC_DIR = ../abc
|
2018-07-27 23:54:52 -05:00
|
|
|
ABC_LIB = libabc.a
|
|
|
|
ABC_LIB_PATH = $(ABC_DIR)/$(ABC_LIB)
|
|
|
|
|
2019-05-04 00:03:04 -05:00
|
|
|
ABC_HEADERS = -I$(ABC_DIR)/src
|
2018-07-27 23:54:52 -05:00
|
|
|
|
2019-05-04 00:03:04 -05:00
|
|
|
LIBS = -lm -ldl -lreadline -pthread
|
2018-07-27 23:54:52 -05:00
|
|
|
DEFINES = -DLIN
|
|
|
|
|
2019-05-04 00:03:04 -05:00
|
|
|
OBJ = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c))
|
|
|
|
OBJ_DIRS=$(sort $(dir $(OBJ)))
|
|
|
|
DEP := $(OBJ:.o=.d)
|
|
|
|
|
2019-05-03 19:56:03 -05:00
|
|
|
$(EXE): $(OBJ) Makefile $(ABC_LIB_PATH)
|
2019-05-04 00:03:04 -05:00
|
|
|
$(CC) $(OBJ) $(CFLAGS) $(INC_FLAGS) $(ABC_HEADERS) $(ABC_LIB_PATH) $(LIBS) -o $(EXE)
|
2018-07-27 23:54:52 -05:00
|
|
|
|
|
|
|
clean:
|
2019-05-03 19:56:03 -05:00
|
|
|
rm -f $(EXE) $(OBJ) $(DEP) $(TARGET) $(EXE)
|
|
|
|
|
|
|
|
# Enable a second round of expansion so that we may include
|
|
|
|
# the target directory as a prerequisite of the object file.
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
|
|
|
# The directory follows a "|" to use an existence check instead of the usual
|
|
|
|
# timestamp check. Every write to the directory updates the timestamp thus
|
|
|
|
# without this, all but the last file written to a directory would appear
|
|
|
|
# to be out of date.
|
2019-05-04 00:03:04 -05:00
|
|
|
$(OBJ): $(OBJ_DIR)/%.o:$(SRC_DIR)/%.c | $$(dir $$@D)
|
|
|
|
$(CC) -c $< $(CFLAGS) $(INC_FLAGS) -o $@ $(ABC_HEADERS) $(DEFINES) $(LIBS)
|
2019-05-03 19:56:03 -05:00
|
|
|
|
|
|
|
# Silently create target directories as need
|
|
|
|
$(OBJ_DIRS):
|
|
|
|
@ mkdir -p $@
|
|
|
|
|
|
|
|
-include $(DEPS)
|
|
|
|
|