diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 46 |
1 files changed, 30 insertions, 16 deletions
@@ -23,24 +23,29 @@ ifneq ($(MAKECMDGOALS),distclean) include include.mk endif -EXECUTABLE := switchctl +EXE_SWITCHCTL := switchctl +EXE_SERIALCLIENT := serialclient -OBJ := log.o \ - sig_handler.o \ - options.o \ - string_list.o \ - key_value_storage.o \ - command_queue.o \ - client_list.o \ - utils.o \ - switchctl.o +COMMONOBJ := log.o \ + sig_handler.o \ + string_list.o \ + key_value_storage.o \ + utils.o \ +SWITCHCTLOBJ := command_queue.o \ + client_list.o \ + opt-switchctl.o \ + switchctl.o -SRC := $(OBJ:%.o=%.c) +SERIALCLIENTOBJ := opt-serialclient.o \ + serialclient.o + + +SRC := $(COMMONOBJ:%.o=%.c) $(SWITCHCTLOBJ:%.o=%.c) $(SERIALCLIENTOBJ:%.o=%.c) options.c .PHONY: clean distclean -all: $(EXECUTABLE) +all: $(EXE_SWITCHCTL) $(EXE_SERIALCLIENT) %.d: %.c @set -e; rm -f $@; \ @@ -52,8 +57,17 @@ ifneq ($(MAKECMDGOALS),distclean) -include $(SRC:%.c=%.d) endif -$(EXECUTABLE): $(OBJ) - $(CC) $(OBJ) -o $@ $(LDFLAGS) +$(EXE_SWITCHCTL): $(COMMONOBJ) $(SWITCHCTLOBJ) + $(CC) $(COMMONOBJ) $(SWITCHCTLOBJ) -o $@ $(LDFLAGS) + +$(EXE_SERIALCLIENT): $(COMMONOBJ) $(SERIALCLIENTOBJ) + $(CC) $(COMMONOBJ) $(SERIALCLIENTOBJ) -o $@ $(LDFLAGS) + +opt-switchctl.o: options.c + $(CC) $(CFLAGS) -DOPT_SWITCHCTL -o $@ -c $< + +opt-serialclient.o: options.c + $(CC) $(CFLAGS) -DOPT_SERIALCLIENT -o $@ -c $< %.o: %.c $(CC) $(CFLAGS) -c $< @@ -68,5 +82,5 @@ clean: rm -f *.o rm -f *.d rm -f *.d.* - rm -f $(EXECUTABLE) - + rm -f $(EXE_SWITCHCTL) + rm -f $(EXE_SERIALCLIENT) |