2012-11-14 11:51:51 +00:00
|
|
|
CC=gcc
|
2013-06-13 00:02:53 +00:00
|
|
|
CXX=g++
|
|
|
|
LD=g++
|
2016-02-07 21:42:15 +00:00
|
|
|
HWSTUB_INCLUDE_DIR=../include
|
2013-06-13 00:02:53 +00:00
|
|
|
HWSTUB_LIB_DIR=../lib
|
2014-12-14 10:53:55 +00:00
|
|
|
REGTOOLS_INCLUDE_DIR=../../regtools/include
|
2013-06-13 00:02:53 +00:00
|
|
|
REGTOOLS_LIB_DIR=../../regtools/lib
|
2016-02-07 21:42:15 +00:00
|
|
|
INCLUDES=-I$(HWSTUB_INCLUDE_DIR) -I$(REGTOOLS_INCLUDE_DIR) `pkg-config --cflags lua5.2` `pkg-config --cflags libusb-1.0`
|
|
|
|
CFLAGS=-Wall -O2 -std=c99 -g $(INCLUDES) -D_XOPEN_SOURCE=600
|
|
|
|
CXXFLAGS=-Wall -O2 -std=c++11 -g $(INCLUDES)
|
2016-10-22 13:55:33 +00:00
|
|
|
LDFLAGS=-lhwstub `pkg-config --libs libusb-1.0` `pkg-config --libs lua5.2` -lreadline -L$(HWSTUB_LIB_DIR) -L$(REGTOOLS_LIB_DIR) -lsocdesc `xml2-config --libs` -pthread
|
2017-01-17 11:01:46 +00:00
|
|
|
EXEC=hwstub_shell hwstub_load hwstub_server hwstub_test hwstub_dump
|
2012-11-14 11:51:51 +00:00
|
|
|
SRC=$(wildcard *.c)
|
2013-06-13 00:02:53 +00:00
|
|
|
SRCXX=$(wildcard *.cpp)
|
|
|
|
OBJ=$(SRC:.c=.o) $(SRCXX:.cpp=.o)
|
|
|
|
LIBS=$(HWSTUB_LIB_DIR)/libhwstub.a $(REGTOOLS_LIB_DIR)/libsocdesc.a
|
2012-11-14 11:51:51 +00:00
|
|
|
|
|
|
|
all: $(EXEC)
|
|
|
|
|
2016-11-07 09:49:01 +00:00
|
|
|
# force target to always rebuild libraries
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
$(HWSTUB_LIB_DIR)/libhwstub.a: FORCE
|
2013-06-13 00:02:53 +00:00
|
|
|
make -C $(HWSTUB_LIB_DIR)
|
|
|
|
|
2016-11-07 09:49:01 +00:00
|
|
|
$(REGTOOLS_LIB_DIR)/libsocdesc.a: FORCE
|
2013-06-13 00:02:53 +00:00
|
|
|
make -C $(REGTOOLS_LIB_DIR)
|
|
|
|
|
2012-11-14 11:51:51 +00:00
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
2013-06-13 00:02:53 +00:00
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2015-06-28 15:51:43 +00:00
|
|
|
hwstub_shell: hwstub_shell.o prompt.o $(LIBS)
|
2013-06-13 00:02:53 +00:00
|
|
|
$(LD) -o $@ $^ $(LDFLAGS)
|
|
|
|
|
|
|
|
hwstub_load: hwstub_load.o $(LIBS)
|
|
|
|
$(LD) -o $@ $^ $(LDFLAGS)
|
2012-11-14 11:51:51 +00:00
|
|
|
|
2017-01-17 11:01:46 +00:00
|
|
|
hwstub_dump: hwstub_dump.o $(LIBS)
|
|
|
|
$(LD) -o $@ $^ $(LDFLAGS)
|
|
|
|
|
2016-02-07 21:42:15 +00:00
|
|
|
hwstub_server: hwstub_server.o $(LIBS)
|
|
|
|
$(LD) -o $@ $^ $(LDFLAGS)
|
|
|
|
|
|
|
|
hwstub_test: hwstub_test.o $(LIBS)
|
|
|
|
$(LD) -o $@ $^ $(LDFLAGS)
|
|
|
|
|
2012-11-14 11:51:51 +00:00
|
|
|
clean:
|
2013-06-13 00:02:53 +00:00
|
|
|
rm -rf $(OBJ) $(LIB) $(EXEC)
|
2012-11-14 11:51:51 +00:00
|
|
|
|
|
|
|
|