Skip to content

Commit 66fbb8c

Browse files
committed
Use plain makefiles
1 parent 1c74cd8 commit 66fbb8c

14 files changed

Lines changed: 402 additions & 66 deletions

Makefile

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 The Procyon Authors
1+
# Copyright 2020 The Procyon Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,12 +12,26 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
include out/cur/args.gn
16-
NINJA=build/lib/bin/ninja -C out/cur
17-
18-
.PHONY: all
1915
all:
20-
@$(NINJA)
16+
17+
OUT ?= out/cur
18+
PROCYON ?= .
19+
EXT ?= ext
20+
GMOCK ?= $(EXT)/gmock
21+
MKDIR_P ?= mkdir -p
22+
23+
-include $(OUT)/config.mk
24+
25+
CPPFLAGS += -MMD -MP
26+
CFLAGS += -Wall
27+
CXXFLAGS += -std=c++11 -Wall
28+
29+
include ext/gmock/build/targets.mk
30+
include build/targets.mk
31+
32+
all: lib bin
33+
lib: $(LIBPROCYON) $(LIBPROCYON_CPP) $(PROCYON_CPP_TEST)
34+
bin: $(LIBPROCYON_BIN) $(PN2JSON) $(PNDUMP) $(PNFMT) $(PNPARSE) $(PNTOK)
2135

2236
.PHONY: test
2337
test: test-python
@@ -33,12 +47,12 @@ test-vim:
3347
misc/vim/test/syntax.vroom
3448

3549
.PHONY: test-cpp
36-
test-cpp:
37-
out/cur/procyon-cpp-test
50+
test-cpp: $(PROCYON_CPP_TEST)
51+
$<
3852

3953
.PHONY: test-wine
40-
test-wine:
41-
xvfb-run wine64 out/cur/procyon-cpp-test.exe
54+
test-wine: $(PROCYON_CPP_TEST)
55+
xvfb-run wine64 $<
4256

4357
.PHONY: regen
4458
regen:
@@ -48,15 +62,15 @@ regen:
4862

4963
.PHONY: clean
5064
clean:
51-
@$(NINJA) -t clean
65+
$(RM) -r $(OUT)/
5266

5367
.PHONY: distclean
5468
distclean:
55-
rm -Rf out/
69+
$(RM) -r out
5670

5771
.PHONY: friends
5872
friends:
59-
@echo "Sure! You can email me at sfiera@sfzmail.com."
73+
@echo "Sure! You can email me at sfiera@twotaled.com."
6074

6175
.PHONY: love
6276
love:

build/libprocyon-bin.mk

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2020 The Procyon Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
LIBPROCYON_BIN := $(OUT)/libprocyon-bin.a
16+
LIBPROCYON_BIN_SRCS := \
17+
$(PROCYON)/src/bin/src/lex.cpp \
18+
$(PROCYON)/src/bin/src/parse.cpp
19+
LIBPROCYON_BIN_OBJS := $(LIBPROCYON_BIN_SRCS:%=$(OUT)/%.o)
20+
21+
$(LIBPROCYON_BIN): $(LIBPROCYON_BIN_OBJS)
22+
$(AR) rcs $@ $+
23+
24+
$(LIBPROCYON_BIN_OBJS): $(OUT)/%.cpp.o: %.cpp
25+
@$(MKDIR_P) $(dir $@)
26+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@
27+
28+
-include $(LIBPROCYON_BIN_OBJS:.o=.d)

build/libprocyon-cpp.mk

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2020 The Procyon Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
LIBPROCYON_CPP := $(OUT)/libprocyon-cpp.a
16+
LIBPROCYON_CPP_SRCS := \
17+
$(PROCYON)/src/cpp/src/array.cpp \
18+
$(PROCYON)/src/cpp/src/data.cpp \
19+
$(PROCYON)/src/cpp/src/file.cpp \
20+
$(PROCYON)/src/cpp/src/map.cpp \
21+
$(PROCYON)/src/cpp/src/string.cpp \
22+
$(PROCYON)/src/cpp/src/value.cpp
23+
LIBPROCYON_CPP_OBJS := $(LIBPROCYON_CPP_SRCS:%=$(OUT)/%.o)
24+
25+
$(LIBPROCYON_CPP): $(LIBPROCYON_CPP_OBJS)
26+
$(AR) rcs $@ $+
27+
28+
$(LIBPROCYON_CPP_OBJS): $(OUT)/%.cpp.o: %.cpp
29+
@$(MKDIR_P) $(dir $@)
30+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@
31+
32+
-include $(LIBPROCYON_CPP_OBJS:.o=.d)

build/libprocyon.mk

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2020 The Procyon Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
LIBPROCYON_CPPFLAGS=-I $(PROCYON)/include
16+
LIBPROCYON_LDFLAGS=-lm -lpthread
17+
18+
LIBPROCYON := $(OUT)/libprocyon.a
19+
LIBPROCYON_SRCS := \
20+
$(PROCYON)/src/c/src/common.c \
21+
$(PROCYON)/src/c/src/dtoa.c \
22+
$(PROCYON)/src/c/src/dump.c \
23+
$(PROCYON)/src/c/src/error.c \
24+
$(PROCYON)/src/c/src/file.c \
25+
$(PROCYON)/src/c/src/format.c \
26+
$(PROCYON)/src/c/src/gen_table.c \
27+
$(PROCYON)/src/c/src/io.c \
28+
$(PROCYON)/src/c/src/lex.c \
29+
$(PROCYON)/src/c/src/numeric.c \
30+
$(PROCYON)/src/c/src/parse.c \
31+
$(PROCYON)/src/c/src/procyon.c \
32+
$(PROCYON)/src/c/src/utf8.c
33+
LIBPROCYON_OBJS := $(LIBPROCYON_SRCS:%=$(OUT)/%.o)
34+
35+
$(LIBPROCYON): $(LIBPROCYON_OBJS)
36+
$(AR) rcs $@ $+
37+
38+
$(LIBPROCYON_OBJS): $(OUT)/%.c.o: %.c
39+
@$(MKDIR_P) $(dir $@)
40+
$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@
41+
42+
-include $(LIBPROCYON_OBJS:.o=.d)

build/pn2json.mk

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2020 The Procyon Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
PN2JSON := $(OUT)/pn2json$(EXE_SUFFIX)
16+
PN2JSON_SRCS := $(PROCYON)/src/bin/src/pn2json.cpp
17+
PN2JSON_OBJS := $(PN2JSON_SRCS:%=$(OUT)/%.o)
18+
19+
$(PN2JSON): $(PN2JSON_OBJS) $(LIBPROCYON_BIN) $(LIBPROCYON) $(LIBPROCYON_CPP)
20+
$(CXX) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)
21+
22+
$(PN2JSON_OBJS): $(OUT)/%.cpp.o: %.cpp
23+
@$(MKDIR_P) $(dir $@)
24+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@
25+
26+
-include $(PN2JSON_OBJS:.o=.d)

build/pndump.mk

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2020 The Procyon Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
PNDUMP := $(OUT)/pndump$(EXE_SUFFIX)
16+
PNDUMP_SRCS := $(PROCYON)/src/bin/src/pndump.cpp
17+
PNDUMP_OBJS := $(PNDUMP_SRCS:%=$(OUT)/%.o)
18+
19+
$(PNDUMP): $(PNDUMP_OBJS) $(LIBPROCYON_BIN) $(LIBPROCYON_CPP) $(LIBPROCYON)
20+
$(CXX) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)
21+
22+
$(PNDUMP_OBJS): $(OUT)/%.cpp.o: %.cpp
23+
@$(MKDIR_P) $(dir $@)
24+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@
25+
26+
-include $(PNDUMP_OBJS:.o=.d)

build/pnfmt.mk

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2020 The Procyon Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
PNFMT := $(OUT)/pnfmt$(EXE_SUFFIX)
16+
PNFMT_SRCS := $(PROCYON)/src/bin/src/pnfmt.cpp
17+
PNFMT_OBJS := $(PNFMT_SRCS:%=$(OUT)/%.o)
18+
19+
$(PNFMT): $(PNFMT_OBJS) $(LIBPROCYON_BIN) $(LIBPROCYON_CPP) $(LIBPROCYON)
20+
$(CXX) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)
21+
22+
$(PNFMT_OBJS): $(OUT)/%.cpp.o: %.cpp
23+
@$(MKDIR_P) $(dir $@)
24+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@
25+
26+
-include $(PNFMT_OBJS:.o=.d)

build/pnparse.mk

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2020 The Procyon Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
PNPARSE := $(OUT)/pnparse$(EXE_SUFFIX)
16+
PNPARSE_SRCS := $(PROCYON)/src/bin/src/pnparse.c
17+
PNPARSE_OBJS := $(PNPARSE_SRCS:%=$(OUT)/%.o)
18+
19+
$(PNPARSE): $(PNPARSE_OBJS) $(LIBPROCYON)
20+
$(CC) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)
21+
22+
$(PNPARSE_OBJS): $(OUT)/%.c.o: %.c
23+
@$(MKDIR_P) $(dir $@)
24+
$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@
25+
26+
-include $(PNPARSE_OBJS:.o=.d)

build/pntok.mk

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2020 The Procyon Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
PNTOK := $(OUT)/pntok
16+
PNTOK_SRCS := $(PROCYON)/src/bin/src/pntok.c
17+
PNTOK_OBJS := $(PNTOK_SRCS:%=$(OUT)/%.o)
18+
19+
$(PNTOK): $(PNTOK_OBJS) $(LIBPROCYON)
20+
$(CC) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)
21+
22+
PNTOK_CFLAGS := -Wno-initializer-overrides
23+
24+
$(PNTOK_OBJS): $(OUT)/%.c.o: %.c
25+
@$(MKDIR_P) $(dir $@)
26+
$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPROCYON_CPPFLAGS) $(PNTOK_CFLAGS) -c $< -o $@
27+
28+
-include $(PNTOK_OBJS:.o=.d)

0 commit comments

Comments
 (0)