-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile.distrib
42 lines (31 loc) · 1018 Bytes
/
Makefile.distrib
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
# Makefile for Aurochs SDK
SRC=src
OBJ=obj
DYNOBJ=dyn
LIB=lib
BIN=bin
AR=ar
CC=gcc
CFLAGS=-Wall -O3
DYNCFLAGS=$(CFLAGS) -fPIC
INCDIRS=-Iinclude
HEADERS=include/base_types.h include/staloc.h include/alloc.h include/pack.h include/peg_prelude.h include/peg_lib.h include/peg.h include/parse_tree.h include/cnog.h
OBJS=$(addprefix $(OBJ)/, staloc.o pushdown.o alloc.o pack.o parse_tree.o cnog.o cnog_unpack.o)
DYNOBJS=$(addprefix $(DYNOBJ)/, staloc.o pushdown.o alloc.o pack.o parse_tree.o cnog.o cnog_unpack.o)
.PHONY: all clean
all: $(LIB)/libaurochs.a $(LIB)/libaurochs.so $(BIN)/check
clean:
rm -f $(OBJ)/*.o
rm -f $(DYNOBJ)/*.o
rm -f $(LIB)/*.a
$(LIB)/libaurochs.a: $(OBJS)
$(AR) r $@ $(OBJS)
$(LIB)/libaurochs.so: $(DYNOBJS)
$(CC) -shared $(DYNOBJS) -o $@
$(OBJ)/%.o: $(SRC)/%.c
$(CC) $(CFLAGS) $(INCDIRS) -c $< -o $@
$(DYNOBJ)/%.o: $(SRC)/%.c
$(CC) $(DYNCFLAGS) $(INCDIRS) -c $< -o $@
$(BIN)/check: $(OBJ)/check.o $(LIB)/libaurochs.a
$(CC) $(CFLAGS) $< -L$(LIB) -laurochs -o $@
%.c: $(HEADERS)