Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017 The Procyon Authors
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,12 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

include out/cur/args.gn
NINJA=build/lib/bin/ninja -C out/cur

.PHONY: all
all:
@$(NINJA)

OUT ?= out/cur
PROCYON ?= .
EXT ?= ext
GMOCK ?= $(EXT)/gmock
MKDIR_P ?= mkdir -p

-include $(OUT)/config.mk

CPPFLAGS += -MMD -MP
CFLAGS += -Wall
CXXFLAGS += -std=c++11 -Wall

include ext/gmock/build/targets.mk
include build/targets.mk

all: lib bin
lib: $(LIBPROCYON) $(LIBPROCYON_CPP) $(PROCYON_CPP_TEST)
bin: $(LIBPROCYON_BIN) $(PN2JSON) $(PNDUMP) $(PNFMT) $(PNPARSE) $(PNTOK)

.PHONY: test
test: test-python
Expand All @@ -33,12 +47,12 @@ test-vim:
misc/vim/test/syntax.vroom

.PHONY: test-cpp
test-cpp:
out/cur/procyon-cpp-test
test-cpp: $(PROCYON_CPP_TEST)
$<

.PHONY: test-wine
test-wine:
xvfb-run wine64 out/cur/procyon-cpp-test.exe
test-wine: $(PROCYON_CPP_TEST)
xvfb-run wine64 $<

.PHONY: regen
regen:
Expand All @@ -48,15 +62,15 @@ regen:

.PHONY: clean
clean:
@$(NINJA) -t clean
$(RM) -r $(OUT)/

.PHONY: distclean
distclean:
rm -Rf out/
$(RM) -r out

.PHONY: friends
friends:
@echo "Sure! You can email me at sfiera@sfzmail.com."
@echo "Sure! You can email me at sfiera@twotaled.com."

.PHONY: love
love:
Expand Down
28 changes: 28 additions & 0 deletions build/libprocyon-bin.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LIBPROCYON_BIN := $(OUT)/libprocyon-bin.a
LIBPROCYON_BIN_SRCS := \
$(PROCYON)/src/bin/src/lex.cpp \
$(PROCYON)/src/bin/src/parse.cpp
LIBPROCYON_BIN_OBJS := $(LIBPROCYON_BIN_SRCS:%=$(OUT)/%.o)

$(LIBPROCYON_BIN): $(LIBPROCYON_BIN_OBJS)
$(AR) rcs $@ $+

$(LIBPROCYON_BIN_OBJS): $(OUT)/%.cpp.o: %.cpp
@$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@

-include $(LIBPROCYON_BIN_OBJS:.o=.d)
32 changes: 32 additions & 0 deletions build/libprocyon-cpp.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LIBPROCYON_CPP := $(OUT)/libprocyon-cpp.a
LIBPROCYON_CPP_SRCS := \
$(PROCYON)/src/cpp/src/array.cpp \
$(PROCYON)/src/cpp/src/data.cpp \
$(PROCYON)/src/cpp/src/file.cpp \
$(PROCYON)/src/cpp/src/map.cpp \
$(PROCYON)/src/cpp/src/string.cpp \
$(PROCYON)/src/cpp/src/value.cpp
LIBPROCYON_CPP_OBJS := $(LIBPROCYON_CPP_SRCS:%=$(OUT)/%.o)

$(LIBPROCYON_CPP): $(LIBPROCYON_CPP_OBJS)
$(AR) rcs $@ $+

$(LIBPROCYON_CPP_OBJS): $(OUT)/%.cpp.o: %.cpp
@$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@

-include $(LIBPROCYON_CPP_OBJS:.o=.d)
42 changes: 42 additions & 0 deletions build/libprocyon.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LIBPROCYON_CPPFLAGS=-I $(PROCYON)/include
LIBPROCYON_LDFLAGS=-lm -lpthread

LIBPROCYON := $(OUT)/libprocyon.a
LIBPROCYON_SRCS := \
$(PROCYON)/src/c/src/common.c \
$(PROCYON)/src/c/src/dtoa.c \
$(PROCYON)/src/c/src/dump.c \
$(PROCYON)/src/c/src/error.c \
$(PROCYON)/src/c/src/file.c \
$(PROCYON)/src/c/src/format.c \
$(PROCYON)/src/c/src/gen_table.c \
$(PROCYON)/src/c/src/io.c \
$(PROCYON)/src/c/src/lex.c \
$(PROCYON)/src/c/src/numeric.c \
$(PROCYON)/src/c/src/parse.c \
$(PROCYON)/src/c/src/procyon.c \
$(PROCYON)/src/c/src/utf8.c
LIBPROCYON_OBJS := $(LIBPROCYON_SRCS:%=$(OUT)/%.o)

$(LIBPROCYON): $(LIBPROCYON_OBJS)
$(AR) rcs $@ $+

$(LIBPROCYON_OBJS): $(OUT)/%.c.o: %.c
@$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@

-include $(LIBPROCYON_OBJS:.o=.d)
26 changes: 26 additions & 0 deletions build/pn2json.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PN2JSON := $(OUT)/pn2json$(EXE_SUFFIX)
PN2JSON_SRCS := $(PROCYON)/src/bin/src/pn2json.cpp
PN2JSON_OBJS := $(PN2JSON_SRCS:%=$(OUT)/%.o)

$(PN2JSON): $(PN2JSON_OBJS) $(LIBPROCYON_BIN) $(LIBPROCYON) $(LIBPROCYON_CPP)
$(CXX) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)

$(PN2JSON_OBJS): $(OUT)/%.cpp.o: %.cpp
@$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@

-include $(PN2JSON_OBJS:.o=.d)
26 changes: 26 additions & 0 deletions build/pndump.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PNDUMP := $(OUT)/pndump$(EXE_SUFFIX)
PNDUMP_SRCS := $(PROCYON)/src/bin/src/pndump.cpp
PNDUMP_OBJS := $(PNDUMP_SRCS:%=$(OUT)/%.o)

$(PNDUMP): $(PNDUMP_OBJS) $(LIBPROCYON_BIN) $(LIBPROCYON_CPP) $(LIBPROCYON)
$(CXX) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)

$(PNDUMP_OBJS): $(OUT)/%.cpp.o: %.cpp
@$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@

-include $(PNDUMP_OBJS:.o=.d)
26 changes: 26 additions & 0 deletions build/pnfmt.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PNFMT := $(OUT)/pnfmt$(EXE_SUFFIX)
PNFMT_SRCS := $(PROCYON)/src/bin/src/pnfmt.cpp
PNFMT_OBJS := $(PNFMT_SRCS:%=$(OUT)/%.o)

$(PNFMT): $(PNFMT_OBJS) $(LIBPROCYON_BIN) $(LIBPROCYON_CPP) $(LIBPROCYON)
$(CXX) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)

$(PNFMT_OBJS): $(OUT)/%.cpp.o: %.cpp
@$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@

-include $(PNFMT_OBJS:.o=.d)
26 changes: 26 additions & 0 deletions build/pnparse.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PNPARSE := $(OUT)/pnparse$(EXE_SUFFIX)
PNPARSE_SRCS := $(PROCYON)/src/bin/src/pnparse.c
PNPARSE_OBJS := $(PNPARSE_SRCS:%=$(OUT)/%.o)

$(PNPARSE): $(PNPARSE_OBJS) $(LIBPROCYON)
$(CC) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)

$(PNPARSE_OBJS): $(OUT)/%.c.o: %.c
@$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPROCYON_CPPFLAGS) -c $< -o $@

-include $(PNPARSE_OBJS:.o=.d)
28 changes: 28 additions & 0 deletions build/pntok.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PNTOK := $(OUT)/pntok
PNTOK_SRCS := $(PROCYON)/src/bin/src/pntok.c
PNTOK_OBJS := $(PNTOK_SRCS:%=$(OUT)/%.o)

$(PNTOK): $(PNTOK_OBJS) $(LIBPROCYON)
$(CC) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)

PNTOK_CFLAGS := -Wno-initializer-overrides

$(PNTOK_OBJS): $(OUT)/%.c.o: %.c
@$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LIBPROCYON_CPPFLAGS) $(PNTOK_CFLAGS) -c $< -o $@

-include $(PNTOK_OBJS:.o=.d)
43 changes: 43 additions & 0 deletions build/procyon-cpp-test.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PROCYON_CPP_TEST := $(OUT)/procyon-cpp-test$(EXE_SUFFIX)
PROCYON_CPP_TEST_SRCS := \
$(PROCYON)/src/cpp/test/data.test.cpp \
$(PROCYON)/src/cpp/test/dump.test.cpp \
$(PROCYON)/src/cpp/test/float.test.cpp \
$(PROCYON)/src/cpp/test/format.test.cpp \
$(PROCYON)/src/cpp/test/io.test.cpp \
$(PROCYON)/src/cpp/test/lex.test.cpp \
$(PROCYON)/src/cpp/test/matchers.cpp \
$(PROCYON)/src/cpp/test/parse.test.cpp \
$(PROCYON)/src/cpp/test/string.test.cpp \
$(PROCYON)/src/cpp/test/utf8.test.cpp \
$(PROCYON)/src/cpp/test/value.test.cpp \
$(PROCYON)/src/cpp/test/valuepp.test.cpp
PROCYON_CPP_TEST_OBJS := $(PROCYON_CPP_TEST_SRCS:%=$(OUT)/%.o)

$(PROCYON_CPP_TEST): $(PROCYON_CPP_TEST_OBJS) $(LIBPROCYON_CPP) $(LIBPROCYON) $(LIBGMOCK_MAIN)
$(CXX) $+ -o $@ $(LDFLAGS) $(LIBPROCYON_LDFLAGS)

PROCYON_CPP_TEST_CPPFLAGS := \
$(LIBPROCYON_CPPFLAGS) \
$(LIBGMOCK_CPPFLAGS) \
-I src/c/src

$(PROCYON_CPP_TEST_OBJS): $(OUT)/%.cpp.o: %.cpp
@$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(PROCYON_CPP_TEST_CPPFLAGS) -c $< -o $@

-include $(PROCYON_CPP_TEST_OBJS:.o=.d)
23 changes: 23 additions & 0 deletions build/targets.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2020 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include build/libprocyon.mk
include build/libprocyon-cpp.mk
include build/libprocyon-bin.mk
include build/procyon-cpp-test.mk
include build/pnfmt.mk
include build/pn2json.mk
include build/pndump.mk
include build/pntok.mk
include build/pnparse.mk
Loading