readarg/Makefile

38 lines
674 B
Makefile
Raw Normal View History

2021-02-08 18:30:32 +00:00
include config.mk
2021-02-08 16:07:25 +00:00
2021-02-08 18:30:32 +00:00
SOURCE = readopt.c
OBJECT = readopt.o
2021-02-08 16:07:25 +00:00
2021-02-08 18:30:32 +00:00
all: $(STATIC) $(SHARED)
2021-02-08 16:07:25 +00:00
%.o: %.c
$(CC) -c $(CFLAGS) $<
2021-02-08 18:30:32 +00:00
$(STATIC): $(OBJECT)
2021-02-08 16:07:25 +00:00
$(AR) $@ $^
2021-02-08 18:30:32 +00:00
$(SHARED): $(OBJECT)
2021-02-08 16:07:25 +00:00
$(CC) --shared $^ -o $@
install: staticinstall sharedinstall
2021-02-08 18:30:32 +00:00
staticinstall: $(STATIC)
2021-02-08 16:07:25 +00:00
$(MKDIR) $(DESTDIR)$(LIB)
$(CP) $^ $(DESTDIR)$(LIB)
2021-02-08 18:30:32 +00:00
$(MKDIR) $(DESTDIR)$(INCL)
$(CP) $(HEADER) $(DESTDIR)$(INCL)
2021-02-08 16:07:25 +00:00
2021-02-08 18:30:32 +00:00
sharedinstall: $(SHARED)
2021-02-08 16:07:25 +00:00
$(MKDIR) $(DESTDIR)$(LIB)
$(CP) $^ $(DESTDIR)$(LIB)
2021-02-08 18:30:32 +00:00
$(MKDIR) $(DESTDIR)$(INCL)
$(CP) $(HEADER) $(DESTDIR)$(INCL)
2021-02-08 16:07:25 +00:00
clean:
2021-02-08 18:30:32 +00:00
$(RM) $(OBJECT) $(STATIC) $(SHARED)
2021-02-08 16:07:25 +00:00
format:
2021-02-08 18:30:32 +00:00
clang-format -i -- $(SOURCE) $(HEADER)
2021-02-08 16:07:25 +00:00
.PHONY: clean install staticinstall sharedinstall format