-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile_combined
57 lines (43 loc) · 1.28 KB
/
Makefile_combined
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
TARGET = builtin.so
PREFIX ?= /usr/local
SRC = .
CFLAGS = -Wall -Werror -std=c99 -pedantic -ggdb
LFLAGS =
LDFLAGS =
# Uncomment the following if target is a Shared library
CFLAGS += -fPIC -I/usr/include/bash -I/usr/include/bash/include
LFLAGS += --shared
# Build module list (info make -> "Functions" -> "File Name Functions")
MODULES = $(addsuffix .o,$(basename $(wildcard $(SRC)/*.c)))
# Libraries need header files. Set the following accordingly:
HEADERS =
# Declare non-filename targets
.PHONY: all install uninstall clean help
all: $(TARGET)
$(TARGET) : $(MODULES)
$(CC) $(LFLAGS) -o $@ $(MODULES) $(LDFLAGS)
%o : %c
$(CC) $(CFLAGS) -c -o $@ $<
# For executable target:
# install:
# install -D -mode=775 $(TARGET) $(PREFIX)/bin
# For shared library targets:
# install:
# install -D --mode=644 $(HEADERS) $(PREFIX)/include
# install -D --mode=775 $(TARGET) $(PREFIX)/lib
# ldconfig $(PREFIX)/lib
# Remove the ones you don't need:
uninstall:
rm -f $(PREFIX)/bin/$(TARGET)
rm -f $(PREFIX)/lib/$(TARGET)
rm -f $(PREFIX)/include/$(HEADERS)
clean:
rm -f $(TARGET)
rm -f $(MODULES)
help:
@echo "Makefile options:"
@echo
@echo " install to install project"
@echo " uninstall to uninstall project"
@echo " clean to remove generated files"
@echo " help this display"